Boschman has asked for the wisdom of the Perl Monks concerning the following question:
I'm attempting to create a subroutine that will take a preexisting cfg file then load it to an array that can be used later in the script, but when I execute it I get the error "Can't use string ("TEST") as a symbol ref while "strict refs" in use ... (F) Only hard references are allowed by "strict refs". Symbolic references are disallowed" My code is as follows:
sub cfgToARRAY { my ($cfgfile, $array) = @_ ; open(OUTPUT, "<", $cfgfile) or die "Can't open $cfgfile: $!" ; my $input ; while ($input = <OUTPUT>) { chomp $input ; push (@$array, $input) ; } close(OUTPUT) ; return(@$array) ; } 1 ;
and what I'm trying to pass to the sub is
cfgToARRAY("/informatica/scripts/arrayDisplayCDCWFs.cfg", "TEST") ;
as a new perl user I'm stumped. Thank you!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Symbolic references disallowed
by aaron_baugher (Curate) on Apr 18, 2012 at 19:49 UTC | |
by davido (Cardinal) on Apr 18, 2012 at 20:25 UTC | |
|
Re: Symbolic references disallowed
by Eliya (Vicar) on Apr 18, 2012 at 18:58 UTC | |
by jwkrahn (Abbot) on Apr 18, 2012 at 19:14 UTC | |
|
Re: Symbolic references disallowed
by toolic (Bishop) on Apr 18, 2012 at 19:39 UTC |