Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: Re: Re: Array in Array

by CombatSquirrel (Hermit)
on Oct 06, 2003 at 14:40 UTC ( #296958=note: print w/replies, xml ) Need Help??

in reply to Re: Re: Array in Array
in thread Array in Array

Your $rec variable is actually a reference to an array. You should dereference it, for example by writing my @rray = @$rec;, or, TIMTOWTDI:
#!/usr/bin/perl use strict; use warnings; my @accounts = ("A x1 B y1 C z1 D v1 E w1 F", "A x2 B y2 C zzz2 D v2 E w2 F", "A x3 B y3 C z3 D v3 E w3 F", "A x4 B y4 C z4 D v4 E wwww4 F", "A x5 B y5 C z5 D v5 E w5 F", "A x6 B y6 C z6 D v6 E F"); my @fields = ("A", "B", "C", "D", "E"); sub tweezers_sub { my @accounts_2 = map { [@{{/([A-Z])\s+([a-z]+\d|\s)/g}}{@fields} ] +} @accounts; for my $rec (@accounts_2) { print "'" . join("' - '", @$rec) . "'\n"; } } tweezers_sub;
This uses a RegEx instead of a split, but you can still see how $rec is dereferenced by writing @$rec.
Hope this helped.
Update: Mixed up referencing and dereferencing. Fixed.
Entropy is the tendency of everything going to hell.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://296958]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (7)
As of 2017-01-17 07:10 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (152 votes). Check out past polls.