Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: Help in using backtick operator

by Perlbotics (Chancellor)
on Oct 31, 2011 at 20:23 UTC ( #934960=note: print w/replies, xml ) Need Help??

in reply to Help in using backtick operator

Not sure if I understand your question correctly, but I would start with:

  • chomp $date; , or better:
  • build $date without shelling out (e.g. POSIX::strftime or localtime and sprintf)
  • using a correct regular expression, e.g. if ($file =~ m/AAAA\*.*?$date/) { ... }
    Update: Missed, that there is a literal * in the filename. \$ matches literal $, not $date. Non-greedy matching is probably not necessary here, but does no harm (in response to question below). It would be a good idea to also anchor the regexp.
  • (also add use strict; and use warnings; if not already done so)

Replies are listed 'Best First'.
Re^2: Help in using backtick operator
by manutd (Initiate) on Oct 31, 2011 at 20:33 UTC
    Yeah i did notice i made a mistake in the regex. But even after making the change it isn't working. if ($file =~ m/AAAA\*$date/) is not working. I haven't understood why you used ? in the regex too.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://934960]
[LanX]: my 2 cents: AngloZionistic sounds like an antisemtic theory, but to be critical of zionism doesn't mean to be anti-semitic
[shmem]: it hasn't been coined as a *mustread* without authority from the promoter
erix shoots an anti-bubble missile towards LanX
[LanX]: I don't have the time to go into depth of this blog though
[LanX]: anti-bubble missile?
[shmem]: LanX, it's not a matter of time, and you know that.
[shmem]: be precise.
[erix]: nevermind, I'm just a bit drunk :)
[shmem]: just to contradict myself: there's so much attention on wording todays, and so much less on meaning
[LanX]: ?

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2018-03-19 21:37 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (246 votes). Check out past polls.