Today around 11:48am, Tom Christiansen hammered out this masterpiece:
: >So basically, it would be nice if each, keys, values, etc. could all deal
: >with being handed a hash from a code block or subroutine...
:
: In the current Perl World, a function can only return as output to
: its caller a LIST, not a HASH nor an ARRAY. Likewise, it can only
: receive a LIST, not those other two.
So, this is really a bug?
#!/usr/local/bin/perl -w
use strict;
$|++;
sub func {
return qw/KeyOne Value1 KeyTwo Value2/;
}
print "$_\n" foreach keys &func();
Shell> ./lab.pl
Type of arg 1 to keys must be hash (not subroutine entry) at ./lab.pl line 10, near
");"
Execution of ./lab.pl aborted due to compilation errors.
Shell>
I think that keys should take a LIST as it's arguments. It would appear that
right now, in the current Perl World, it should. The above should yeild
something like:
KeyOne
KeyTwo
Rather than that error.
--
print(join(' ', qw(Casey R. Tweten)));my $sig={mail=>'[EMAIL PROTECTED]',site=>
'http://home.kiski.net/~crt'};print "\n",'.'x(length($sig->{site})+6),"\n";
print map{$_.': '.$sig->{$_}."\n"}sort{$sig->{$a}cmp$sig->{$b}}keys%{$sig};
my $VERSION = '0.01'; #'patched' by Jerrad Pierce <belg4mit at MIT dot EDU>