> Tom Franklyn <[EMAIL PROTECTED]> wrote:From: "Tom Franklyn" 
> Subject: Is it a perl Bug?
> Date: Wed, 04 Feb 2004 12:43:56 +0200
> 
> Dear all,
> 
> I've following code :
> 
> ==========
> #!/usr/bin/perl
> 
> my $a = "ab:cd:ef";
> my @b = split(/:/,$a);
> print ("@b\n");
> 
> my @c = ('/:/', $a);
> my @d = split(@c);
> print ("@d\n");
> ===========
> Whats wrong with my code?
> why @b and @d give different output?

Never use $a and $b as variables in Perl outside of a sort subroutine.
They are used by the sort function.

Secondly, study perldoc -f split, especially the arguments:

split /PATTERN/,EXPR,LIMIT
split /PATTERN/,EXPR
split /PATTERN/
split

It's not a perl bug.

Luke

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to