in reply to Backreferences

It seems your else-statements have syntax errors.

Replies are listed 'Best First'.
Re^2: Backreferences
by karlgoethebier (Abbot) on Jan 06, 2018 at 19:34 UTC
    "...syntax errors."
    #!/usr/bin/env perl use strict; use warnings; my $line; print "\n"; $line = '<a href="http://www.mysite.com/" target="_blank">'; $line =~ /\shref=(["'])?([^\s\>\1]+)/; # FIRT MATCH if ( defined $1 ) { print "\$1= $1\n"; } else { print "1) not defined\n"; } if ( defined $2 ) { print "\$2= $2\n"; } else { print "2) not defined\n"; } print "\n"; $line =~ /\shref=(["'])?([^\s\>"']+)/; # SECOND MATCH if ( defined $1 ) { print "\$1= $1\n"; } else { print "1) not defined\n"; } if ( defined $2 ) { print "\$2= $2\n"; } else { print "2) not defined\n"; } __END__ karls-mac-mini:playground karl$ perl -c testomato.pl testomato.pl syntax OK

    Apparently not. How did you jump to this conclusion?

    «The Crux of the Biscuit is the Apostrophe»

    perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

      Apparently the AM is referring to the wrong spelling of firth in the comment just before the first if

      Ah, yes. See also Firt.

      Thanks and best regards, Karl

      «The Crux of the Biscuit is the Apostrophe»

      perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help