Re: HoA building
- From: cajun@xxxxxxxxxxxx (M. Lewis)
- Date: Thu, 28 Dec 2006 01:39:36 -0500
John W. Krahn wrote:
Ok, but why? Are they not the same?my ($prod, $flavor) = split /\s/, $ln, 2;You probably should use ' ' instead of /\s/ as the first argument to
split:
my ($prod, $flavor) = split ' ', $ln, 2;
No.
$ perl -le'
my $ln = " one two three four ";
print map " *$_* ", split /\s/, $ln, 2;
print map " *$_* ", split " ", $ln, 2;
'
** * one two three four *
*one* *two three four *
$ perl -le'
my $ln = "one two three four ";
print map " *$_* ", split /\s/, $ln, 2;
print map " *$_* ", split " ", $ln, 2;
'
*one* * two three four *
*one* *two three four *
/\s/ matches a single whitespace character, ' ' matches one or more whitespace
characters.
John
Thanks very much John and Chad. Excellent information and examples!
Thank you!
--
IBM: It's Been Malfunctioning
01:35:01 up 13 days, 22:26, 0 users, load average: 0.52, 0.55, 0.46
Linux Registered User #241685 http://counter.li.org
.
- References:
- HoA building
- From: "M. Lewis"
- Re: HoA building
- From: John W. Krahn
- Re: HoA building
- From: "M. Lewis"
- Re: HoA building
- From: John W. Krahn
- HoA building
- Prev by Date: Re: HoA building
- Next by Date: Re: HoA building
- Previous by thread: Re: HoA building
- Next by thread: Re: HoA building
- Index(es):
Relevant Pages
|