Help for this page

Select Code to Download


  1. or download this
    open FILE, '<', $file or die "...";
    while (<FILE>) {
    ...
      handle(FILE, 'that') if m/that/;
    }
    close FILE;
    
  2. or download this
    open my {I/O}FILE, '<', $file or die "...";
    while (<{I/O}FILE>) {
    ...
      handle({I/O}FILE, 'that') if m/that/;
    }
    close {I/O}FILE;
    
  3. or download this
    open my {I/O}FILE, '<', $file or die "...";
    while (defined($_ = {I/O}FILE->readline)) {
    ...
      handle({I/O}FILE, 'that') if $_ =~ m/that/;
    }
    {I/O}FILE->close;
    
  4. or download this
    sub handle {
      my $fh = shift;
    ...
    
      ...
    }