Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: using constants in regex/search

by f00li5h (Chaplain)
on Dec 02, 2008 at 04:52 UTC ( #727302=note: print w/replies, xml ) Need Help??

in reply to using constants in regex/search

use constant'ed constants are really subs that just return the same thing each time... there's no un-nasty way to interpolate them. TheDamian's perl best practices recommends using Readonly for constants for this reason.

Also  $input =~ /@{[ NAME ]}/ ... but if you do that, the maintenence programmer after you will hunt you down with a hatchet and do unspeakable things to you.

Enjoy ^_^

@_=qw; ask f00li5h to appear and remain for a moment of pretend better than a lifetime;;s;;@_[map hex,split'',B204316D8C2A4516DE];;y/05/os/&print;

Replies are listed 'Best First'.
Re^2: using constants in regex/search
by geniezlife (Initiate) on Dec 02, 2008 at 08:51 UTC
    Thanks! :)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://727302]
[Corion]: Do you have any specific interests or general Perl knowledge?
[Cosmic37]: should I slurp? should I grep? Noble Lords I wish you good karma and beg your advice
[Corion]: Cosmic37: Ah, see perlfaq4, about How do I compute the intersection of two arrays
[Cosmic37]: I am out of practice; I use Perl for scientific programming for number crunching
[Corion]: Cosmic37: Basically, you read one file into a hash, keyed by your key, and then match the lines from the second file to that hash
[Cosmic37]: note that the two files only have datetimes which may match whereas other data per line is different format in file1 and file2 - is that really intersection?
[jedikaiti]: Hi Monks
[Corion]: Cosmic37: Well, if you want to use only parts of a line for the key, see split or whatever other mechanism to extract the key from the line
[Corion]: Hi jedikaiti!
[Cosmic37]: is there a webpage for full CB for this chat rather than side panel chat?

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2017-06-29 16:18 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (672 votes). Check out past polls.