Hello hchana,
Welcome to the monastery. Try this:
Execute it as perl <name.pl> <filename>
#!usr/bin/perl use strict; use warnings; while (<>) { print "$.\t$_"; # updating $. $.\t$_ } continue { close ARGV if eof; }
Update: Adding line output from ($.) to ($.\t$_).
Read more here eof.
In reply to Re: open and read text file
by thanos1983
in thread open and read text file
by hchana
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |