On Oct 30, 5:37 am, [EMAIL PROTECTED] (Irfan Sayed) wrote:
> Hi All,
>
> I have one variable which stores the value as follows.
>
> "2007-09-07T12:50:26+05:30  aic_8.0_Integration  ccvob01" Now my
> requirement is that I want to store aic_8.0_Integration part of the
> string in different variable.
>
> so what I did was I ran following code.
>
> chomp(my @strm = split(/ /, $IntegrationStream)); where
> $IntegrationStream stores the above string.
>
> But the issue is that when I try to access $strm[1] , I am not getting
> expected result. i.e. aic_8.0_Integration  
>
> Can you please guide me how should I achieve this.

Annoyingly,
split / /, $foo;
and
split ' ', $foo;
are not the same thing.  split ' ', $foo is a special case that means
to split on all sequences of whitespace.  It means the same thing as
split /\s+/, $foo;  In your statement, you're only splitting on a
single whitespace character.  There are two spaces in your string, so
you're getting a null string as the second element of the returned
list, since there is a "nothing" in between the two space characters.

Paul Lalli


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


Reply via email to