manishrathi has asked for the wisdom of the Perl Monks concerning the following question:
Now when I am writing following codeopen FILE, "C:/Users/Admin/Desktop/Books/read.txt" or die "Can't open +: $!\n"; @content = <FILE>; print @content; $last = pop(@content); print "\n".$last. "\n";
"print @content;" prints number of elements within array content (ie scalar context).open FILE, "C:/Users/Admin/Desktop/Books/read.txt" or die "Can't open +: $!\n"; @content = <FILE>; print @content."\n\n"; $last = pop(@content); print "\n".$last. "\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Printing array in scalar context
by NetWallah (Canon) on Aug 08, 2011 at 05:21 UTC | |
|
Re: Printing array in scalar context
by TomDLux (Vicar) on Aug 08, 2011 at 17:34 UTC |