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 $string = '100955 BLow-Gomez,Joseph MMEX.AMER. QHUTC012';

 

my $id = split(/\s/,$string);

 

print "id = $id";

 

Output:

4

 

This is the no. of elements in the array generated by split.

 

Why in first case (when brackets are used) it prints correct id?

 

Thanks & Regards,

Sanket Vaidya


_____________________________________________________________________ 

This e-mail message may contain proprietary, confidential or legally privileged 
information for the sole use of the person or entity to whom this message was 
originally addressed. Any review, e-transmission dissemination or other use of 
or taking of any action in reliance upon this information by persons or 
entities other than the intended recipient is prohibited. If you have received 
this e-mail in error kindly delete this e-mail from your records. If it appears 
that this mail has been forwarded to you without proper authority, please 
notify us immediately at netad...@patni.com and delete this mail.
_____________________________________________________________________

Reply via email to