in reply to Error: Uninicialized Value
Try it like this:
use warnings; use strict; chomp( my @horiz = <STDIN> ); my @dates = grep length, split /\|/, shift @horiz; for my $line ( @horiz ) { my ( undef, $PID, $SID, @flds ) = split /\|/, $line, -1; for my $date ( @dates ) { print "$PID|$SID|", shift( @flds ), "|$date\n"; } }
|
|---|