Recent Changes - Search:




Reading from a File

The -n switch allows you to loop through a file whose name is provided at the command line.

The Perl statements are enclosed in quotes, and the file or files are listed at the end of the command line.

The -e switch allows Perl to execute Perl statements at the command line instead of from a script.

This is a good way to test simple Perl statements before putting them into a script file.

shine@shine:~$ perl -ne 'print if /^shine/ ;' /etc/passwd

shine@shine:~$ perl -e 'print "My name is Shine\n";'
My name is Shine

Edit - History - Print - Recent Changes - Search
Page last modified on July 16, 2012, at 10:04 AM