Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: lsuser epoch translate

by sn1987a (Chaplain)
on Aug 15, 2014 at 17:54 UTC ( #1097598=note: print w/replies, xml ) Need Help??


in reply to lsuser epoch translate

The key difference between your code and atcroft's code above is the quotes. With the double quotes in your example, the shell will replace the $1 before perl gets to see it. Using the single quotes will protect the variable names.
$ echo "19284732 Test message 123456789012345" | perl -pe "s/(\d{8,})/ +scalar localtime $1/e;" Fri Aug 15 12:52:29 2014 Test message 123456789012345 $ echo "19284732 Test message 123456789012345" | perl -pe 's/(\d{8,})/ +scalar localtime $1/e;' Tue Aug 11 23:52:12 1970 Test message 123456789012345

Replies are listed 'Best First'.
Re^2: lsuser epoch translate
by dcronin135 (Acolyte) on Oct 06, 2014 at 01:46 UTC

    You are absolutely right! Don't know how I missed such a simple syntax.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2019-04-23 05:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I am most likely to install a new module from CPAN if:
















    Results (114 votes). Check out past polls.

    Notices?