Re: split()'s pattern argument
- From: "Jerry Adair" <jerry.adair@xxxxxxx>
- Date: Thu, 30 Mar 2006 16:06:17 -0500
Thanks David (and Xho),
Unfortunately I needed to do more than just split $_ on whitespace. I made
it work by calling split with the regex pattern that contained the scalar
and then simply checking the resultant list for a beginning NULL value. If
so, I just shifted to the next value and went on about my business. It
seems clug-eee to me, but it works and handles all of the test cases I've
thrown at it, so...
Thank y'all again.
Jerry
<usenet@xxxxxxxxxxxxxxx> wrote in message
news:1143752243.428795.257730@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Jerry Adair wrote:
to split(), it just so happens that the first line of data begins with a
space, followed by two "words" that are separated by whitespace. So the
list that I get back from split() has 3 elements in it
If all you want to do is split $_ on whitespace ignoring any leading
whitespace the you can simply say "split". Observe:
#!/usr/bin/perl
use warnings; use strict;
$_ = ' foo bar ';
my @array = split;
print map {"'$_'\n"} @array;
__END__
--
http://DavidFilmer.com
.
- References:
- split()'s pattern argument
- From: Jerry Adair
- Re: split()'s pattern argument
- From: usenet
- split()'s pattern argument
- Prev by Date: Re: split()'s regex pattern parameter
- Next by Date: Re: Find duplicates in a dat file
- Previous by thread: Re: split()'s pattern argument
- Index(es):