in reply to Re: Re: chomp any data structure recursively
in thread chomp any data structure recursively

Looking at just this part:
sub mychomp { ref eq 'ARRAY' ...
That's ref of $_, which you have not yet set up, so it's the outer $_ from the caller. Luckily, you didn't test your subroutine with something that needed ref-ARRAY treatment as an argument. {grin}.

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re: Re: Re: Re: chomp any data structure recursively
by Juerd (Abbot) on Dec 21, 2001 at 01:48 UTC
    I always thought and assumed the for modifier would set $_ ...
    (You did see it, didn't you? It's just before the sub's closing curly.)

    2;0 juerd@ouranos:~$ perl -e'undef christmas' Segmentation fault 2;139 juerd@ouranos:~$

      Argh. You do have a for, waaaaaaaay down there. OK, I'm gonna write this one down as a tough-to-maintain snippet then. Seeing that, you're fine.

      -- Randal L. Schwartz, Perl hacker