Help for this page

Select Code to Download


  1. or download this
    my $filename = shift // die "Usage: $0 <filename | ->\n";
    
    my $fh = *STDIN;
    ...
    while (<$fh>) {
        # Process lines of input
    }
    
  2. or download this
    use 5.012;
    use warnings;
    use autodie;
    ...
    open STDIN, '<', $filename if $filename ne '-';
    
    while (<STDIN>) { ... }