Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Reading a file and working only on certain lines

by wjw (Priest)
on Nov 11, 2014 at 19:15 UTC ( [id://1106873]=note: print w/replies, xml ) Need Help??


in reply to Reading a file and working only on certain lines

A bit more info would be helpful. Read How do I Post a Question Effectively

or

My version of the same

Your problem statement breaks down as follows from my perspective:

  • Get input from user
  • GetOpt::Long
  • Open file for reading
  • open

    If the file is not too large, you might consider reading it into and array(ex. my @lines)

  • Search for line(?s) containing user provided characters
  • grep might work well for you
  • Do calculation on lines found
  • maybe write a sub-routine to do your calculations?
  • Provide output to user(file, screen, web page,...?) Might want to consider this


... and always remember to:
use strict; use warnings; etc...

Hope that is helpful...

...the majority is always wrong, and always the last to know about it...

Insanity: Doing the same thing over and over again and expecting different results...

A solution is nothing more than a clearly stated problem...otherwise, the problem is not a problem, it is simply an inconvenient fact

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-24 18:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found