Skip to Content
Programming PERL in the .NET Environment
book

Programming PERL in the .NET Environment

by Yevgeny Menaker, Michael Saltzman, Robert J. Oberg
September 2002
Intermediate to advanced content levelIntermediate to advanced
496 pages
10h
English
Addison-Wesley Professional
Content preview from Programming PERL in the .NET Environment

Special Perl Variables

As you learn Perl, you will become familiar with many special Perl variables, each of which arms the Perl programmer with a more elegant way of writing some code. Probably the most common special variable is named $_. This variable plays a few important roles in the life of a Perl programmer.

The Default Input and Output Variable $_

Earlier, we presented a segment of code that read lines from the standard input and printed them.

while($line = <STDIN>)
{
    print $line;
}

Within a loop, if you do not name a variable to be the recipient of the input, Perl uses the variable $_ by default. Likewise, if you do not give any arguments to the print function, then $_ is printed by default. Thus, the above code could have been written ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Sams Teach Yourself Perl in 21 Days, Second Edition

Sams Teach Yourself Perl in 21 Days, Second Edition

Laura Lemay, Rafe Colburn
Pro Perl

Pro Perl

Peter Wainwright

Publisher Resources

ISBN: 0130652067Purchase book