Help for this page

Select Code to Download


  1. or download this
    my $last = (map {/^.*(pat)/} <>)[-1];
    
  2. or download this
    my ($last) = (`grep pat file`)[1] =~ /^.*(pat)/;
    
  3. or download this
    use autodie;
    open my $fh, "<", "file";
    ...
    while (<>) {
        $last = $1 if /^.*(pat)/;
    }