Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: How to parse this file

by jwkrahn (Monsignor)
on Oct 19, 2011 at 17:03 UTC ( #932447=note: print w/ replies, xml ) Need Help??


in reply to How to parse this file

#!/usr/bin/perl use warnings; use strict; use Scalar::Util qw/ looks_like_number /; my ( $file_in, $file_out ) = ( 'file1.txt', 'file2.txt' ); open my $IN, '<', $file_in or die "Cannot open '$file_in' because: $ +!"; open my $OUT, '>', $file_out or die "Cannot open '$file_out' because: +$!"; while ( <$IN> ) { print $OUT join( "\t", grep looks_like_number( $_ ), split ), "\n" +; } __END__


Comment on Re: How to parse this file
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (17)
As of 2015-07-29 16:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (265 votes), past polls