in reply to Re^4: How to combine these 2 subroutines in one?
in thread How to combine these 2 subroutines in one?
Ok, I tried this
and, if I pass the list as a reference it works OK, whereas, if I pass it as a simple array I get:
sub clean_list { my $type_of_arg=ref(@{ $_[0] }); print "Type of argument passed is: $type_of_arg\n"; } open(IN, '<', 'ex5.acc') or die "Could not read file\n"; my @initial_array = <IN>; close IN; clean_list(@initial_array); clean_list(\@initial_array);
and, if I pass the list as a reference it works OK, whereas, if I pass it as a simple array I get:
The L13923 is the first id that I have in my input file...Can't use string ("L13923") as an ARRAY ref while "strict refs" in use + at Lesson10.pl line 32.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^6: How to combine these 2 subroutines in one?
by Athanasius (Archbishop) on Apr 04, 2014 at 08:55 UTC | |
by Anonymous Monk on Apr 04, 2014 at 09:14 UTC | |
by Athanasius (Archbishop) on Apr 04, 2014 at 09:36 UTC | |
by Anonymous Monk on Apr 04, 2014 at 09:41 UTC |
In Section
Seekers of Perl Wisdom