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

[perl #30505] Passing qr/\s+/ into a subroutine as a delimiter for split seems to cause a subsequent call to that function to fail in v5.6.1

Thread Next
From:
Reel, Joseph [FI]
Date:
June 28, 2004 07:20
Subject:
[perl #30505] Passing qr/\s+/ into a subroutine as a delimiter for split seems to cause a subsequent call to that function to fail in v5.6.1
Message ID:
rt-3.0.11-30505-91523.3.74535964970278@perl.org
# New Ticket Created by  "Reel, Joseph [FI]" 
# Please include the string:  [perl #30505]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=30505 >


In Perl 5.6.1 the following script

#!/opt/mr/perl/bin/perl -w
use strict;

my @c = test ("dealloans    dat", qr/\s{1,256}/);
my @d = test ("dealloans|dat", qr/\|/);
print "@c\n";
print "@d\n";

sub test {
    my ($data, $delim) = @_;
    my @d = split /$delim/, $data;
    return @d;
}

results in output

dealloans dat
dealloans dat

as expected, but replacing qr/\s{1,256}/ above with qr/\s+/ gives output

dealloans dat
dealloans|dat

so it looks like the second subroutine call fails.


Thread Next


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