Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: reading input into a number of arrays

by choroba (Archbishop)
on Feb 25, 2020 at 16:07 UTC ( #11113411=note: print w/replies, xml ) Need Help??


in reply to reading input into a number of arrays

Perl doesn't support the comma separated indices for multidimensional arrays. Instead of
$a[$i, 1]

use

$a[$i][1]

Update: Use warnings, Perl will tell you:

Multidimensional syntax $a[$i,1] not supported at ...

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^2: reading input into a number of arrays
by tobyink (Canon) on Feb 25, 2020 at 21:41 UTC

    You can emulate multi-dimentional arrays with hashes though. It's a feature not many people use.

    my %multidim; my $x = 3; my $y = 4; $multidim{ $x, $y } = 42; print $multidim{ $x, $y }, "\n";
Re^2: reading input into a number of arrays
by Dannypje (Initiate) on Feb 25, 2020 at 16:11 UTC
    Choroba, thanks! I knew this. My shame is infinite.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2020-05-25 08:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (144 votes). Check out past polls.

    Notices?