http://www.perlmonks.org?node_id=774394


in reply to Re^2: a REFERENCE of array of hashes
in thread a REFERENCE of array of hashes

I haven't got too much time so a couple of points to start with.

Learn regular expressions. I mean it. They look like a mess to begin with, but I promise, they're SO useful. I don't really use pack/unpack, so this isn't definitive, but I think they're usually used for 'weird' characters and formatting, or manipulating bits. Well, I'm sure many people will argue with 'usually' and tbh, if they can enlighten me on the matter, it'd be useful..!

A quick tip to get you going:

my $text="fakeemail@somewhere.com"; $text =~ /(.+?)@(.+?)/; print "$1, $2"; -------------- fakeemail, somewhere.com
=~ is the regex operator. the groups, indicated with brackets () that you match show up in the variables $1 and $2.

For comma separated values, I would also recommend that you use 'split' as I mentioned before. It's much easier and if the format of your fields change, it won't screw up your program.

@client is an array. A real array. You know it's a real array because you declared it 'my @client'.

\%entry is a hash reference. So you've made an array of hash references. I'm not sure really what they mean by a 'reference array of hashes' but I would interpret it in the way that you have.

why_bird
p.s. I haven't tested the snippets of code here or below, just so you know!
........
Those are my principles. If you don't like them I have others.
-- Groucho Marx
.......