sanket vaidya wrote:
Hi,
Hello,
Consider the code below:
use warnings;
use strict;
my $string = '100955 BLow-Gomez,Joseph MMEX.AMER. QHUTC012';
my ($id) = split(/\s/,$string);
print "id = $id";
Output:
100955
Now remove brackets surrounding $id like as under:
use warnings;
use strict;
Hi,
Consider the code below:
use warnings;
use strict;
my $string = '100955 BLow-Gomez,Joseph MMEX.AMER. QHUTC012';
my ($id) = split(/\s/,$string);
print "id = $id";
Output:
100955
Now remove brackets surrounding $id like as under:
use warnings;
use strict;
my $s
i.com]
> Sent: Wednesday, May 27, 2009 4:16 PM
> To: beginners@perl.org
> Subject: Question about split
>
> Hi all,
>
>
>
> Kindly look at the code below:
>
>
>
> use warnings;
>
> use strict;
>
>
>
> $_ = 'Welcome to openSUSE 11.0 (X
Because first element of the array is empty
-Original Message-
From: sanket vaidya [mailto:sanket.vai...@patni.com]
Sent: Wednesday, May 27, 2009 4:16 PM
To: beginners@perl.org
Subject: Question about split
Hi all,
Kindly look at the code below:
use warnings;
use strict
-Original Message-
From: Chas. Owens [mailto:chas.ow...@gmail.com]
Sent: Wednesday, May 27, 2009 4:52 PM
To: sanket vaidya
Cc: beginners@perl.org
Subject: Re: Question about split
On Wed, May 27, 2009 at 06:45, sanket vaidya
wrote:
> Hi all,
>
> Kindly look at the code below
On Wed, May 27, 2009 at 06:45, sanket vaidya wrote:
> Hi all,
>
> Kindly look at the code below:
>
> use warnings;
> use strict;
>
> $_ = 'Welcome to openSUSE 11.0 (X86-64) - Kernel \r (\l).';
>
> my @numbers = split /\D+/;
snip
> Why the first element of @numbers is 'blank'? Kindly explain with e
Hi all,
Kindly look at the code below:
use warnings;
use strict;
$_ = 'Welcome to openSUSE 11.0 (X86-64) - Kernel \r (\l).';
my @numbers = split /\D+/;
for (0..$#numbers)
{
print "$_ : $numbers[$_]\n";
}
Output:
0 :
1 : 11
2 : 0
3 : 86
4 : 64
Why the first element