Help for this page

Select Code to Download


  1. or download this
    $! = 0;
    $line = <$file>;
    ...
            { print "reached eof\n"; }
    else
            { $line=~/(.*)/; print qq(read a line: "$1"); }
    
  2. or download this
    echo $'three\nshort\nlines' > a;
     perl -we 'open $f, "<", "a"; for(0..3) { $!=10000; $l = <$f>; $s = $!
    +; warn +(defined($l)?$l=~/(.*)/&&qq/"$1"/:"undef"), " $s\n"; }'
    
  3. or download this
    "three" Bad file descriptor
    "short" Unknown error 10000
    "lines" Unknown error 10000
    undef 
    undef