I have recently discovered qr// and it seems to be the only way to cut and paste a functioning regex literal into a variable assignment. Notice below I had to do little more than cut and paste the regex literal from Method 3 into the qr expression in Method 1. Nifty. That is PRECISELY what I want to do. This isn't in my Perl 5 camel book, but it is in perldoc 5.005_03, so I guess the feature is newer than my book, so I want to make sure I understand the alternatives in case I am in a situation in which I am using an older version of Perl.
1. What did people did prior to the arrival of qr//. 2. Why did I think there was something one could do with quotemeta to get a similar effect? 3. Is there a way to use Method 2, if I need it for an older perl, without having to manually backslash \ and " 4. Are there characters other than \ and " I might have to backslash in a similar situation as Method 2? #!/usr/bin/perl -w # Method 1: qr// is ideal, and works $patt_1 = qr/(?i)<A[^>]*?\s+?HREF=["'\s]+?([^"'\s]*)["'\s]+?/; # Method 2: seems a bit error prone due to manual backslashing $patt_2 = "(?i)<A[^>]*?\\s+?HREF=[\"'\\s]+?([^\"'\\s]*)[\"'\\s]+?"; while (<>) { # Method 3: regex literal # while (/(?i)<A[^>]*?\s+?HREF=["'\s]+?[^"'\s]*["'\s]+?/sogi) { while (/$patt_2/sogi) { print "$1\n"; } } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]