On Wed, 2008-08-20 at 19:03 +0530, Irfan J Sayed (isayed) wrote: > Hi All, > > Can you please tell me what is the value of $file. When i execute this > script . it says "Can't open : No such file or directory" > > Please suggect. > > Regards > > Irf. > > #!/usr/bin/perl > > # file: count_lines.pl > > # Figure 1.4: Count the lines of a file > > use strict; > > use IO::File; > > my $file = shift;
This is a shortcut for: my $file = shift @ARGV; $file is assign the first command-line argument. When you run the script try placing the name of a file after it: perl count_lines.pl some_file.txt -- Just my 0.00000002 million dollars worth, Shawn "Where there's duct tape, there's hope." "Perl is the duct tape of the Internet." Hassan Schroeder, Sun's first webmaster -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/