This line works fine:
if ($link =~ m#/([^/]*)$#) {

But this one in its place does not work:
if ($link =~ m/\/([^/]*)$/) { # Oddly this does not work

Gives error:
Unmatched [ in regex; marked by <-- HERE in m//([ <-- HERE ^/ at csvtopo24.pl line 74.


I think it has to do with the "[^/]*".
Anybody have an explanation for this?


Mike


Simplified code:

#!/usr/bin/perl

use strict;
use warnings;

my $link = '/tree';

#if ($link =~ m/\/([^/]*)$/) { # Oddly this does not work
if ($link =~ m#/([^/]*)$#) {
    my $match = $1;
    print "\nIt worked - $match.\n\n";
}

__END__

--
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