Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: How to extract these groups of characters?

by toolic (Bishop)
on Aug 26, 2015 at 01:16 UTC ( [id://1139942]=note: print w/replies, xml ) Need Help??


in reply to How to extract these groups of characters?

split:
use warnings; use strict; use Data::Dumper; my $str = 'joe 0.0000E 000 9.0720E-001 d23 9.0208E-001'; my @words = split /\s+/, $str; print Dumper(\@words); __END__ $VAR1 = [ 'joe', '0.0000E', '000', '9.0720E-001', 'd23', '9.0208E-001' ];

Replies are listed 'Best First'.
Re^2: How to extract these groups of characters?
by hippo (Bishop) on Aug 26, 2015 at 08:23 UTC

    I think that to reflect the OP's requirement and keep the scientific notation numbers as single fields the split regex should be /\s\s+/ instead. In all other aspects the approach looks solid.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1139942]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-19 21:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found