Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Pattern Match/Trim Variables.

by enoch (Chaplain)
on Feb 17, 2003 at 20:10 UTC ( #236094=note: print w/replies, xml ) Need Help??


in reply to Pattern Match/Trim Variables.

You can replace those 4 substition with one transliteration.
$line =~ tr/\t\n\r"/\x09\x0A\x0D'/;
And, then, since the date format is fixed, just match up until the period.
$line =~ s{ ( # start capturing into $1 [\d|/|\s|:]+ # match digits, # forward slashes, spaces, # or colons 1 or more times ) \. # stop capturing into $1 # when you hit a period \d\d\d} # match three more digits {$1}x; # replace it all w/ $1


enoch

edit: removed the ig options from the tr because they are not necessary (and not even valid) options.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://236094]
help
Chatterbox?
[Corion]: Hi jedikaiti!
[Cosmic37]: is there a webpage for full CB for this chat rather than side panel chat?
[Cosmic37]: thank you for advice
[Cosmic37]: peach greets jedi
[Cosmic37]: ok this one works better fullpage chat
[Cosmic37]: test
[Cosmic37]: sort of anyway... hurls some peaches... :-D

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (9)
As of 2017-06-29 16:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (672 votes). Check out past polls.