Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: Text filer and assign

by johngg (Canon)
on Oct 06, 2015 at 13:23 UTC ( [id://1143923]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Text filer and assign
in thread Text filer and assign

system("pvscan>>pv.txt1"); open my $FH,"pv.txt1" or die "Cannot open file: $!";

I see that you append to the pv.txt1 file which means more lines to parse every time you run the script; is this actually intended? Unless you want to keep the output of pvscan hanging around you can open a file handle directly on piped commands. Something like:-

open my $pvscanFH, '-|', 'pvscan' or die "Cannot fork pvscan: $!\n";

You can then read the command output line by line just as if it was a file on disk.

I hope this is helpful.

Cheers,

JohnGG

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-24 04:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found