cool use for map

Peter Scott Peter at PSDT.com
Wed Oct 30 11:55:35 CST 2002


At 09:40 AM 10/30/02 -0800, nkuipers wrote:
>well, it may be a vagary of activestate perl, but when I ran this:
>
>@array = map {$1} 'aagctGGGGTCAGAtttttacGCATCAaa' =~ m/([A-Z]+)/g;
>print "Found $_\n" for @array;
>
>I got
>
>Found GGGGTCAGA
>Found GCATCA

What version of perl?  I tried it on ActiveState 5.6.1 and it says

Found GCATCA
Found GCATCA

I get the same results on Solaris perl 5.6.1 and 5.004, and Linux perl 
5.6.0 and 5.9.0.  I don't have anything in between to try it on.

Just to be clear about it, here's a paste from my DOS window:

C:\WINDOWS\Desktop>perl -le "@array = map {$1} 
'aagctGGGGTCAGAtttttacGCATCAaa'~ m/([A-Z]+)/g;print qq(Found $_) for @array"
Found GCATCA
Found GCATCA

I wonder whether your perl is broken.
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com/




More information about the Victoria-pm mailing list