Read line by line
Read line by line
while(<>) {
# print line number and line
print $., $_;
}
This works for cat <file> | <script.pl>, <script.pl> <file> and <script.pl> enter text via stdin
while(<>) {
# print line number and line
print $., $_;
}
This works for cat <file> | <script.pl>, <script.pl> <file> and <script.pl> enter text via stdin