Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: extracting data and saving into seperate files

by Happy-the-monk (Abbot)
on Jan 09, 2006 at 11:50 UTC ( #521899=note: print w/replies, xml ) Need Help??

in reply to extracting data and saving into seperate files

First thing to notice is you forgot to initially open the original text file. So whether or not the count of line numbers is right, there is no data to work with.

Cheers, Sören

  • Comment on Re: extracting data and saving into seperate files

Replies are listed 'Best First'.
Re^2: extracting data and saving into seperate files
by blazar (Canon) on Jan 09, 2006 at 13:45 UTC

    He's using <> so the original text file is implicitly opened if given on the cmd line. I guess you already knew, but you may have just overlooked it.

    To be sure, just take his code and modify it like thus:

    #!/usr/bin/perl -l my @file = <>; print 0+@file;


    $ ./ data.txt 46 $ wc data.txt 46 36 346 data.txt

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://521899]
[erix]: that's a good one. I must remember that :P
[stevieb]: I really dislike how perlbrew doesn't list your version of perl if a newer minor version bump has happened. eg: I use 5.24.1, but 5.24.2 is available, hiding my 5.24.1. I may look at this, as I made it display correctly in berrybrew in cases like this
[stevieb]: choroba just gleaned your post about Module::Starter. I use it too, pretty much for every dist I write

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2017-08-18 20:46 GMT
Find Nodes?
    Voting Booth?
    Who is your favorite scientist and why?

    Results (310 votes). Check out past polls.