in reply to Matching quoted variables. Cant make it work..

A couple of quibbles to start:

When I run you first case through the debugger, I get 'empty array' as the result of
$x = (qq/$a/ =~ qq/$b/)
I suspect that this is a more appropriate way of writing your use of the regex:

($n = $a) =~ /$b/;

With the proviso (I'm repeating myself) that $a and $b should not be used as variable names except in sort { $a <=> $b} @array;

emc

" When in doubt, use brute force." — Ken Thompson

Reparented from duplicate thread Reaped: Matching quoted variables. Cant make it work.. by Arunbear