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.
  • I stared at it and stared at it but didn't see it until I actually tried the code. Then it hit me; "$/ has been modified so it's hanging at the <STDIN>!" Thanks for a very fun lunchtime distraction.
    #!/usr/bin/perl
    use strict;
    use warnings;

    my $file = shift || die "No file, dummy!";
    open FH, "<", $file or die "Could not open ($file) for reading: $!";
    my @records;

    {
      local $/ = "\n.\n";
      chomp(@records = <FH>);
    };

    for my $record (@records) {
        print $record;
        <STDIN>;
    }