Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: Passing array into a hash

by toolic (Bishop)
on Mar 28, 2013 at 15:20 UTC ( #1025975=note: print w/replies, xml ) Need Help??

in reply to Passing array into a hash

Here's one way (use $all_msgs instead of @all_msgs):
use warnings; use strict; my @all_files = 5..7; errors( all_msgs => \@all_files, msg_subject => 'Error files', mail_msg => 'Listed files for processing:', ); sub errors { my (%args) = @_; my $all_msgs = $args{all_msgs} || ''; my $msg_subject = $args{msg_subject} || ''; my $mail_msg = $args{mail_msg} || ''; foreach my $msgs (@{ $all_msgs }) { print "$msgs\n"; } } __END__ 5 6 7

Replies are listed 'Best First'.
Re^2: Passing array into a hash
by Anonymous Monk on Mar 28, 2013 at 15:34 UTC
    Thank you! I spaced out on getting it with "$" and not with "@".

    Thats the way:
    my $all_msgs = $args{all_msgs} || '';
    and processing it:
    foreach my $msgs (@{ $all_msgs }) { ...
    Problem solved, thanks again!

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2016-10-24 10:17 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (304 votes). Check out past polls.