Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Why open the file manually? Let the magic of <> do it for you. Change:
    my $file = shift;

    die unless defined $file and length $file;
    my $subject;
    my $entry;
    {
        open my $fh, $file or die "Cannot open $file: $!\n";
        $subject = <$fh>;
        $entry = join('', <$fh>);
        close($fh)
    }
    chomp $subject;
    to
    my $subject = <>;
    chomp $subject;

    my $entry = join( '', <> );
    Magical @ARGV processing is your friend!
    --

    --
    xoa

    • Erm. It's an artefact that I should've removed. The program used to do much more. Then I realised the other features were irritating me.
      --
        ---ict / Spoon