Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: How do i extract 3 variables from each line in a file, and print them to a new file

by monarch (Priest)
on Jul 08, 2005 at 16:14 UTC ( [id://473467]=note: print w/replies, xml ) Need Help??


in reply to How do i extract 3 variables from each line in a file, and print them to a new file

If you just want the last 3 numbers in a line you can use a regular expression:
my $line = "3434 34456... 321ms:543ms:45ms"; if ( $line =~ m/(\d+)\D+(\d+)\D+(\d+)\D+$/ ) { print( "$1,$2,$3\n" ); }
  • Comment on Re: How do i extract 3 variables from each line in a file, and print them to a new file
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://473467]
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: (2)
As of 2024-04-26 07:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found