Think about Loose Coupling | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Hi pipeops,
You should follow the advice above, it makes your code readable and you had to preview before you could post, so you must have noticed something wrong. Any way what you need to do is to start matching at the first word, and match anything up to your pattern and match anything to the end word. By putting a capturing parenthesis around the pattern the pattern will be returned if assigned in a list context, putting a variable in parenthesis makes it a list of one and so the first captured value will be assigned to it.
print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."
In reply to Re: simple regex question
by Utilitarian
|
|