Simple compiled regexp not working



Kindly consider the following code which illustrates my question:

#!/usr/bin/perl
use strict; use warnings;

my $line = '08/29/2006 to 08/30/2006';
my $date_rx = qr{m!\d{2}/\d{2}/\d{4}!};

print "regexp matches\n" if $line =~ m!\d{2}/\d{2}/\d{4}!;
print "date_rx matches\n" if $line =~ /$date_rx/;

__END__

The way I read perlop, both print statements should fire, as they
should be doing the exact same match. But I only see the first one.
grrr. This ought to be really simple.

--
David Filmer (http://DavidFilmer.com)

.



Relevant Pages

  • Re: Tricky: java.lang.StackOverflowError due to recursive call in warning messages construction
    ... | From: "Alexandre Delarge" ... | 11000 print statements when executed with Sun JVM 1.3.1_11 and MS JDBC ... | * 4- Retrieve warnings ... |> in warning messages construction ...
    (microsoft.public.sqlserver.jdbcdriver)
  • Re: Firing without the clip in
    ... aka the Jericho to the Isralei Army (imported by Magnum Research). ... It comes with clear warnings that it WILL ... fire with the magazine out and a round in the chamber. ...
    (rec.guns)
  • Re: Problem in nested sorts
    ... I get warnings with and without the print statements. ... Perl level. ... "Reply" at the bottom of the article headers. ...
    (comp.lang.perl.misc)
  • Event ID:4098 Source:Event System Catagory Firing Agent
    ... Xseries running windows 2000 server, ... were just warnings we wouldn't worry to much about it, ... minutes from the time you hit Ctrl+Alt+Delete to full logon, ... The COM+ Event System failed to fire the Logon method on subscription ...
    (microsoft.public.win2000.general)
  • Re: Perl module Net::Oping Error
    ... use warnings; ... and get_recv_ttl is a hashref (which is consistent with what you got ... in your print statements). ...
    (perl.beginners)