
perl-diddler at tlinx
May 4, 2012, 11:10 PM
Post #38 of 39
(145 views)
Permalink
|
Eric Brine wrote: > ...if some useful behaviour can't be found, that is. > ========= Along the same lines (alt syntax), why should this yield an error: #!/usr/bin/perl -w use strict; sub mins { my $p=shift; @_ and do { my $H = shift; my ($tM, $M) = ($H,0); @_ ? #if (@_) { ($M, $tM)=(shift, 100*$H+$M) ($H, $M) = (int $H/100, $tM % 60); #} @$p{'H','M','tM'} = ($H, $M, $tM); return $p; }; undef; } bless my $p={},__PACKAGE__; my $t=mins($p, 1800); printf "h M tM= %02d %02d %03d\n", $t->{H}, $t->{M}, $t->{tM}; ---- > /tmp/pp.pl Assignment to both a list and a scalar at /tmp/pp.pl line 12, near ");" Execution of /tmp/pp.pl aborted due to compilation errors. Seems to be similar to what the OP was wanting, but generates what appears to be a bogus error message. Where's the assignment to a scalar?
|