Rob Dixon wrote:
Jim wrote:

How do I match a line ending in
,@@)
using a regular expression?

my $line = "1234567890,@@)\n";

if ($line =~ m/,@@\)$/) {
  print "OK\n";
}

Be careful with unescaped "@" characters:

$ perl -wle'
  my $line = "1234567890,@+)\n";
  # print $line;
  my $qr = qr/,@+\)$/;
  # print $qr;
  print $line =~ m/$qr/ ? "YES" : "NO";
'
YES

--
Ruud

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to