in reply to split help

This is based on the Camel book's description of split. Its a good book maybe you should get yourself a copy.
#!/usr/local/bin/perl my $data='DATETIME 09:59:11'; my (@sout) = split /[\s,:]/, $data; print $sout[1];

Plankton: 1% Evil, 99% Hot Gas.

Replies are listed 'Best First'.
Re: Re: split help
by pzbagel (Chaplain) on Sep 22, 2003 at 17:39 UTC

    Plankton, great answer! Now you can use a array slice to throw away what you don't need:

    #!/usr/local/bin/perl my $data='DATETIME 09:59:11'; my $sout = (split /[\s,:]/, $data)[1]; print $sout ."\n";

    Later