Help for this page

Select Code to Download


  1. or download this
    while (my $line = <STDIN>) {
      &do_something_with($line);
    }
    
  2. or download this
    while (defined(my $line = <STDIN>)) {
      &do_something_with($line);
    }
    
  3. or download this
        The following lines are equivalent:
    
            while (defined($_ = <STDIN>)) { print; }
    ...
    
            while (($_ = <STDIN>) ne '0') { ... }
            while (<STDIN>) { last unless $_; ... }