YAPC::2004::Israel << Previous | Index | Next >> Copyright © 2004 Gaal Yahas

Where $_ is convenient


  • You can use a lexical variable instead in the following examples, but you can also use $_

  • A foreach loop:

     foreach (@devices)
        $_->ping or log_unreachable($_);
     }
  • Reading lines:

     while (<>) {
        $config{$1} = $2 if /([^#].*?)\s*=\s*(.*)/;
     }