Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Symbolic references disallowed

by Eliya (Vicar)
on Apr 18, 2012 at 18:58 UTC ( #965779=note: print w/ replies, xml ) Need Help??


in reply to Symbolic references disallowed

A more typical way to handle this would be to say

sub cfgToARRAY { my ($cfgfile) = @_ ; open(OUTPUT, "<", $cfgfile) or die "Can't open $cfgfile: $!" ; my $input ; my @array; while ($input = <OUTPUT>) { chomp $input ; push (@array, $input) ; } close(OUTPUT) ; return(@array) ; } ### my @TEST = cfgToARRAY("/informatica/scripts/arrayDisplayCDCWFs.cfg");

instead of specifying the name of the output array as an argument to the subroutine.

(Upd: changed @OUTPUT to @TEST, 'cos that's what I actually meant to type in the first place (to match the name chosen by the OP) )


Comment on Re: Symbolic references disallowed
Download Code
Re^2: Symbolic references disallowed
by jwkrahn (Monsignor) on Apr 18, 2012 at 19:14 UTC

    A more idiomatic way to handle this would be to say:

    sub cfgToARRAY { my ( $cfgfile ) = @_ ; open my $OUTPUT, '<', $cfgfile) or die "Can't open $cfgfile: $!"; chomp( my @array = <$OUTPUT> ); return @array; } ### my @OUTPUT = cfgToARRAY( "/informatica/scripts/arrayDisplayCDCWFs.cfg" + );

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2015-07-04 09:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (58 votes), past polls