in reply to Use of implicit split to @_ is deprecated

You've got dots here, where there should be commas. The obvious cleanup is to use length(), and I can't think of any reason he didn't. Another option would be to use tr///c.

You could put no warnings 'uninitialized' in the block around this bit of code, or you could make it $var_cdrcellsplit = @{[split(...)]} if you want to retain the split for some reason.

Update: or $var_cdrcellsplit = do { my @f = split(...) };
or $var_cdrcellsplit = () = split(//, $var_cdrcellname, -1)
Update 2: got careless. The latter is the same as using //g, which will match an extra time.
Update 3: $var_cdrcellsplit = () = split(/(?<!^)(?!$)/, $var_cdrcellname, -1)


The PerlMonk tr/// Advocate

Replies are listed 'Best First'.
Re: Use of implicit split to @_ is deprecated
by Abigail-II (Bishop) on Jun 04, 2004 at 15:49 UTC
    Update: or $var_cdrcellsplit = do { my @f = split(...) }; or $var_cdrcellsplit = () = split(//, $var_cdrcellname, -1)

    They are not equivalent. And you also may expect that leaving the -1 off doesn't make a difference. However, try to guess the output of the following program:

    #!/usr/bin/perl use strict; use warnings; my $str = "foobar"; my $c1 = do {my @f = split // => $str}; my $c2 = () = split // => $str => -1; my $c3 = () = split // => $str; print "$c1 $c2 $c3\n"; __END__
    Answer after the <readmore> tag.

    Abigail