#!/usr/bin/env perl use strict; use warnings; use Scalar::Util qw( looks_like_number ); while( <DATA> ){ my @numbers = map { $_ + 0 } grep { looks_like_number $_ } split; print "@numbers\n"; } __DATA__ 360.000 -0.000100033 -1.76122e-05 -9.89111e-05 -1.9003e-05 640.000 -4.54467e-05 9.13758e-05 -4.50576e-05 9.04804e-05
In reply to Re: How to read string with numbers
by shawnhcorey
in thread How to read string with numbers
by luxs
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |