In recent messages four different ways of importing a search pattern '$str' emerged as follows: $str =~ /\/(.*)\/(.*)/; while(<IN>) { if (eval('$_ =~ /$1/'.$2)) {print $_} }; ------------------ 1 eval ('while(<IN>) { if ($_ =~ /'.$1.'/'.$2.') {print $_}}'); ----------- 2 eval('sub match { shift =~ /'.$1.'/'.$2.'}'); --------------------------- 3 while(<IN>) {if ( &match($_)) {print $_}}; $pattern = "(?$2)$1"; --------------------------------------------------- 4 while(<IN>) { if ($_ =~ /$pattern/) {print $_;next;}} The times over a 4,322 line file were: (1) 83s (84s with 'i' modifier) (2) 3.83s (3.86s with 'i' modifier) (3) 6.98s (7.86s with 'i' modifier) (4) 20.42 (22.43 with 'i' modifier) The results show up very clearly the large 'eval' overhead (1) and moderate sub-routine call overhead (3). The performance of the favourite: <$str =~ /(?$2)$1/> out of Perl 5 was disappointing. Why so slow I wonder? Methods 1, 2 and 3, constructed as concatenated single-quoted strings, all work. Re-written as interpolated double-quoted strings (A, B, C below), I expected them to behave identically. However not all seem to do so. while(<IN>) {if ( eval("$_ =~ /$1/$2") ) {print $_}}; ------------------- A eval ("while(<IN>) { if ($_ =~ /$1/$2) {print $_}}"); ------------------- B eval("sub match { shift =~ /$1/$2}"); ----------------------------------- C 'A' gives rise to curious error messages and does not carry out the search. 'B' does nothing at all. Only 'C' works as expected. Am I doing/expecting the wrong things to/from Perl/MacPerl? Alan