Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: small regex help

by sulfericacid (Deacon)
on Jun 17, 2006 at 00:35 UTC ( [id://555913]=note: print w/replies, xml ) Need Help??


in reply to small regex help

The following code is untested, but probably has a 90-95% chance of working.
#!/usr/bin/perl use warnings; use strict; open(LOG, "source.txt") or die "Error: $!"; my @lines = <LOG>; close(LOG); my $cnt = 0; foreach my $line (@lines) { $cnt++; $line =~ m/(\d+\s+)(.+)/; $lines[$cnt] = "$1 (Birthday) $2 - singer"; } open(LOG, "> source2.txt") or die "Error $!"; print LOG join("\n", @lines); close(LOG);


"Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

sulfericacid

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (7)
As of 2024-04-19 20:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found