in reply to Arg passing trick that fails in perl 5.8

That is really odd, because it should be one or the other, but not both. For example:
sub odd_args { my ($this, $args) = @_; print $args->{x},$/; } sub odd_args { my ($this, %args) = @_; print $args{x},$/; }
Are you sure there wasn't a prototype?

Update: As pfaut pointed out, this seems to be some kind of automatic casting that 5.6.1 could do, though I can see why this "feature" was removed.

Replies are listed 'Best First'.
Re: Re: Arg passing trick that fails in perl 5.8
by pfaut (Priest) on Jan 10, 2003 at 16:52 UTC

    Is there any reason for the args to be created as a reference to a hash? If you just want to get at your arguments by name, it should just use a hash. There's no reason to use a reference. In this case, tadman's second option would be correct but that requires more changes to your code to remove the '->' dereference on all argument accesses.

    --- print map { my ($m)=1<<hex($_)&11?' ':''; $m.=substr('AHJPacehklnorstu',hex($_),1) } split //,'2fde0abe76c36c914586c';
Re: Re: Arg passing trick that fails in perl 5.8
by tall_man (Parson) on Jan 10, 2003 at 16:20 UTC
    Are you sure there wasn't a prototype?

    There was no prototype. The sample code worked exactly as shown. I briefly considered using a prototype as a fix, but it wouldn't work. A reference prototype requires that you use a real "%" in the argument list and then converts that to a reference in the subroutine.