Frank Wiles wrote:
> .------[ Jerry Preston wrote (2003/01/22 at 11:59:14) ]------ |
> | I am looking for a better way, a perl way for the following: |
> | foreach ( @data ) ) {
> | s/^ //;
> | $data_[ $jp++ ] = $_;
> | }
> |
> `-------------------------------------------------
>
> I'm assuming you are wanting to remove all entries in @data that
> begin with a space, this will do it in one line:
>
> @data = map( { if( $_ !~ s/^ //) { $_; } }, @data);
That doesn't compile. What are you trying to do?
Not sure why you're assuming that's what he wants, but if it is, wouldn't a
simple grep be the way to do it?
@data = grep $_ !~ /^ /, @data;
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]