OK, I got it working...

First of all, if you leave out the pattern, the default delimiter is any
white space, which suits my needs fine.

When I changed the code to this everything worked fine:

$_ = `some command`;
chomp;
@fields = split;

I'm not sure why the other form didn't work.

-----Original Message-----
From: Jonathan Chan [mailto:[EMAIL PROTECTED]
Sent: Monday, September 15, 2003 3:21 PM
To: Eric Hennessey; [EMAIL PROTECTED]
Subject: Re: A silly (I think) question


At 02:11 PM 9/15/2003 -0400, Eric Hennessey wrote:
>I've got an issue with a split function, or at least I THINK that's where 
>I'm having the problem.
>
>Given that $line is one line of output from a command in column format, I 
>run the following:
>
>$line = `some command`;
>chomp $line;
>@fields = split $line;
>
>This should produce a list of strings from $line, right?
>
>Any idea why I'd have an empty list when $line contains the expected data 
>as verified from a print command?


try @fields = split /seperator/, $line;

_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to