Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Uninitialized warnings trouble

by jwkrahn (Abbot)
on Dec 13, 2022 at 21:17 UTC ( [id://11148839]=note: print w/replies, xml ) Need Help??


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>;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11148839]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-04-19 17:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found