On Thu, Feb 21, 2002 at 10:47:43AM +1030, Daniel Falkenberg wrote:
> $string = "Business&PersonalFAD AFD:test(Regional)";
>
> @line = split/\s+/, $string;
>
> Now $line[1] prints nothing? Am I doing something wrong here?
> perl -wle '@line = split(/\s+/, $ARGV[0]; print $line[1];'
"B
On Feb 21, Deen Hameed said:
># split works on whitespace by default
>@somearray = split $string;
Err, that splits $_ on the contents of $string. Yes, split() uses
whitespace by default, but that default is the FIRST argument.
What I'm saying is that
split;
is equivalent to
split ' ';
This is correct, but for the sake of readability I'd put the /\s+/ in there
anyway.
-Original Message-
From: Deen Hameed [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 20, 2002 10:39 PM
To: Daniel Falkenberg
Cc: [EMAIL PROTECTED]
Subject: Re: Splitting variable...
#
# split works on whitespace by default
@somearray = split $string;
deen
--
Deen Hameed, Accidental Programmer [EMAIL PROTECTED]
On Thu, 21 Feb 2002, Daniel Falkenberg wrote:
> Hey all,
>
> I am working with a variable at the moment where I want it to be split
> at every 'space' such as ...
>
ursday, 21 February 2002 10:40 AM
To: Daniel Falkenberg; [EMAIL PROTECTED]
Subject: Re: Splitting variable...
What you are doing is correct.
-paresh.
At 10:20 AM 2/21/2002 +1030, Daniel Falkenberg wrote:
>Hey all,
>
>I am working with a variable at the moment where I want it to be spl
What you are doing is correct.
-paresh.
At 10:20 AM 2/21/2002 +1030, Daniel Falkenberg wrote:
>Hey all,
>
>I am working with a variable at the moment where I want it to be split
>at every 'space' such as ...
>
>$string = "the quick brown fox";
>
>How would I go about doing this? Would I do somet