develooper Front page | perl.perl5.porters | Postings from June 2001

Re: Bug report: split splits on wrong pattern

Thread Previous
From:
Marcel Grunauer
Date:
June 27, 2001 04:57
Subject:
Re: Bug report: split splits on wrong pattern
Message ID:
20010627115724.RYCG6087.viemta06@localhost
Update:

> sub mysplit {
>         my ($orig, $pat, $limit) = @_;
>         $pat = qr/\s+/ unless ref($pat) eq 'Regexp';
>         $limit ||= 0;
>         print "orig  = <$orig>\n";
>         print "pat   = <$pat>\n";
>         print "limit = <$limit>\n";
>         $DB::single = 1;
>         print join ':' => split($pat, $orig, $limit);
>         print "\n\n";
> }

It works if you replace the 'join' line with:

         eval 'print join ":" => split($pat, $orig, $limit);';
         die $@ if $@;

(That idea came from seeing the correct debugger output and
thinking that it must do an eval to get there.)

Marcel

--
We are Perl. Your table will be assimilated. Your waiter will adapt to
service us. Surrender your beer. Resistance is futile.
  -- London.pm strategy aka "embrace and extend" aka "mark and sweep"

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About