RE: Creating variables of a string

2002-04-02 Thread Nikola Janceski
field. A split with no arguments really does a split(' ', $_) internally. > -Original Message- > From: John W. Krahn [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, April 02, 2002 3:54 PM > To: [EMAIL PROTECTED] > Subject: Re: Creating variables of a string > &g

Re: Creating variables of a string

2002-04-02 Thread John W. Krahn
Nikola Janceski wrote: > > That always confused me, by default split splits by /\s+/ so why confuse us > more by making " " and ' ' magical. No, the default is NOT /\s+/, the following are all equivalent: @words = split; @words = split ' '; @words = split ' ', $_; John -- use Perl; program f

RE: Creating variables of a string

2002-04-02 Thread Nikola Janceski
From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, April 02, 2002 3:34 PM > To: Timothy Johnson > Cc: David Gray; [EMAIL PROTECTED] > Subject: RE: Creating variables of a string > > > On Apr 2, Timothy Johnson said: > > >So if you wanted to s

RE: Creating variables of a string

2002-04-02 Thread Jeff 'japhy' Pinyan
On Apr 2, Timothy Johnson said: >So if you wanted to split on just one space, would split / /,$variable be >treated as magical as well? No. As the split() documentation ALSO states, only split(' ') and split(" ") are treated magically. split(/ /) splits on a single space; the others split as i

RE: Creating variables of a string

2002-04-02 Thread Timothy Johnson
So if you wanted to split on just one space, would split / /,$variable be treated as magical as well? -Original Message- From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 02, 2002 11:50 AM To: David Gray Cc: [EMAIL PROTECTED] Subject: RE: Creating vari

RE: Creating variables of a string

2002-04-02 Thread Jeff 'japhy' Pinyan
On Apr 2, David Gray said: >> Michael Stearman wrote: >> >> my ($target, $count, $num) = split ' ', $word; > >I think that needs to be: > >my ($target,$count,$num) = split /\s+/, $word; > >to handle multiple spaces between the values. No. As the split() documentation states, split(' ') is magic

RE: Creating variables of a string

2002-04-02 Thread David Gray
> Michael Stearman wrote: > > > > Right now it is not working and I was wondering if I sent the code > > maybe someone with more experience with this will see the > problem. I > > am very new to this. The line I am trying to create the variables > > from is > > > > C6xxxSimulator(TI)

Re: Creating variables of a string

2002-04-02 Thread John W. Krahn
[Please don't top-post] Michael Stearman wrote: > > Right now it is not working and I was wondering if I sent the code maybe > someone with more experience with this will see the problem. I am very new > to this. The line I am trying to create the variables from is > > C6xxxSimulator(TI)

RE: Creating variables of a string

2002-04-02 Thread Jason Larson
> -Original Message- > From: Michael Stearman [mailto:[EMAIL PROTECTED]] > Subject: Re: Creating variables of a string > > Right now it is not working and I was wondering if I sent the > code maybe > someone with more experience with this will see the problem.

Re: Creating variables of a string

2002-04-02 Thread Jeff 'japhy' Pinyan
On Apr 2, Michael Stearman said: >Michael 57 3 > >I want to assign each of these three to different variables. My only >problem is that the word and the numbers are always different and the space >between the words and numbers is always different as well. Does anyone know >how I would

RE: Creating variables of a string

2002-04-02 Thread Timothy Johnson
nt "Target = $target \n"; print "Count = $count \n"; -Original Message- From: Michael Stearman [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 02, 2002 9:28 AM To: [EMAIL PROTECTED] Subject: Re: Creating variables of a string Right now it is not working and I was wondering if

Re: Creating variables of a string

2002-04-02 Thread Michael Stearman
es anyone have any ideas? I'm lost. >From: "Tanton Gibbs" <[EMAIL PROTECTED]> >To: "Tanton Gibbs" <[EMAIL PROTECTED]>, "Michael Stearman" ><[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> >Subject: Re: Creating variables of a string

Re: Creating variables of a string

2002-04-02 Thread Tanton Gibbs
Actually, since the others are numbers you could replace the last two \S+ with \d+ - Original Message - From: "Tanton Gibbs" <[EMAIL PROTECTED]> To: "Michael Stearman" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, April 02, 2002 12:06 P

Re: Creating variables of a string

2002-04-02 Thread Tanton Gibbs
my ($word, $num1, $num2) = $string =~ /^\s*(\S+)\s+(\S+)\s+(\S+)\s*$/; This matches ^ - the start of the string \s* - any number (including 0) of spaces (\S+) - any number (not including 0) of NON spaces. It also saves the value \s+ - any number (not including 0) of spaces (\S+) - see above \s+