sschneid has asked for the wisdom of the Perl Monks concerning the following question:
$user->{'host'} needs to be an array, even if it contains only one item. The code I have works, but gives out an error:my ($user); # This isn't defined explicity in production code, I'm just doing it h +ere to # illustrate what I (could) get back. $user->{'host'} = '*'; unless ($user->{'host'} > 1) { my $hList = $user->{'host'}; delete $user->{'host'}; push @{$user->{'host'}}, $hList; }
...which is understandable, since it's not an array, it's a string.Can't use string ("*") as an ARRAY ref while "strict refs" in use at t +est.pl line 16.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: String or array?
by friedo (Prior) on Sep 15, 2005 at 18:54 UTC | |
|
Re: String or array?
by ikegami (Patriarch) on Sep 15, 2005 at 18:52 UTC | |
by sschneid (Deacon) on Sep 15, 2005 at 18:54 UTC | |
by ikegami (Patriarch) on Sep 15, 2005 at 18:55 UTC | |
by sschneid (Deacon) on Sep 15, 2005 at 18:58 UTC | |
|
Re: String or array?
by borisz (Canon) on Sep 15, 2005 at 18:57 UTC |