
davorg
Thaumaturge
/ Moderator
Aug 16, 2002, 1:29 AM
Post #6 of 6
(526 views)
|
What exactly do you need to know? $_ is the default variable. It is used as the default input and/or output for a number of Perl operators and functions. Often when $_ is being used, it isn't seen. For example:
while (<FILE>) { print if /some_pattern/; } In that code, $_ is used three times, but it doesn't appear at all. 1/ When used in a "while" loop, the file input operator writes its results to $_. 2/ By default, the match operator works on the contents of $_. 3/ If "print" is given no arguments, it will print the contents of $_. Does that help? -- Dave Cross, Perl Hacker, Trainer and Writer http://www.dave.org.uk/ Get more help at Perl Monks
|