in reply to Re^2: Help with loops
in thread Help with loops
Better, just be direct @email = ( $pointer->{'pscemail1'}, $pointer->{'pscemail2'} ... );
But thats too repetitive , too many quotes/arrows/$pointer , too much typing and/or copy/paste, so shorter @email = @{$pointer}{ qw/ pscemail1 pscemail2 ... /});
Thats much less repetitive and shorter, but still too repetitive, so shorter to write @emails = map { $pointer->{'pscemail'.$_} } 1 .. 8;
Another alternative, just to blow your mind, a tiny bit of api as language, if $pointer was more than a simple hash, if it was an object like a $row, with an emails method,
you could use for my $toemail ( $row->emails ){ ... }
yeah you could eliminate @emails and just drop that map statement instead of $row->emails.... choices sure complicate stuff :D
|
|---|