throop has asked for the wisdom of the Perl Monks concerning the following question:
I have a hash, %unk. Its values are tab-delimited lists of alphanumeric IDs. I want to print out the hash, with entries sorted in descending order by how many IDs they have. I use the Schwartzian transform . It works well but I've had to use a hack:
The hack is @foo; it's an unused variable. But if I drop it:use vars qw(%unk, @foo); my(@ulist) = map{ # Sort descending $_->[1] } sort{ $b->[0] <=> $a->[0] } map{ [scalar(@foo=split(/\t/, $unk{$_})), $_ ] } keys %unk;
I get the warning[scalar(split(/\t/, $unk{$_})), $_ ]
Is there a better workaround than what I'm doing?Use of implicit split to @_ is deprecated at extractions line 393.
throop
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Bogus variable to avoid 'split' warning
by merlyn (Sage) on Feb 16, 2007 at 19:45 UTC | |
by kyle (Abbot) on Feb 16, 2007 at 20:18 UTC | |
|
Re: Bogus variable to avoid 'split' warning
by Tanktalus (Canon) on Feb 16, 2007 at 20:05 UTC | |
|
Re: Bogus variable to avoid 'split' warning
by Cristoforo (Curate) on Feb 16, 2007 at 20:55 UTC | |
|
Re: Bogus variable to avoid 'split' warning
by Moron (Curate) on Feb 19, 2007 at 12:27 UTC |