in reply to Uninitialized warnings trouble

foreach (<$lines>) { chomp; for my $l (0..length()-1) { my ($digit) = /^.{$l}(.)/; if (defined $digit) { $row[$current][$l] = $1; } } $current += 1; }

A more Perl way to write that would be:

while ( <$lines> ) { chomp; push @row, [ split // ]; }

Replies are listed 'Best First'.
Re^2: Uninitialized warnings trouble
by tybalt89 (Monsignor) on Dec 13, 2022 at 21:46 UTC

    Or

    @row = map [ split /\n?/ ], <$lines>;