I am trying to get all the 6 letter names in the second field in DATA below, eg
BARTON DARWIN DARWIN But the script below gives me all 6 letter and more entries. What I read says {6} means exactly 6. What is the correct RE? I have solved the problem my using if (length($data[1]) == 6 ) but would love to know the correct syntax for the RE TIA Owen ================================================================= #!/usr/bin/perl use strict; use warnings; while (<DATA>) { my $line = $_; my @line = split /,/; $line[1] =~ s /\"//g; print "$line[1]\n" if $line[1] =~ /\S{6}/; } __DATA__ "0200","AUSTRALIAN NATIONAL UNIVERSITY","ACT","PO Boxes" "0221","BARTON","ACT","LVR Special Mailing" "0800","DARWIN","NT",,"DARWIN DELIVERY CENTRE" "0801","DARWIN","NT","GPO Boxes","DARWIN GPO DELIVERY ANNEXE" "0804","PARAP","NT","PO Boxes","PARAP LPO" "0810","ALAWA","NT",,"DARWIN DELIVERY CENTRE" "0810","BRINKIN","NT",,"DARWIN DELIVERY CENTRE" "0810","CASUARINA","NT",,"DARWIN DELIVERY CENTRE" "0810","COCONUT GROVE","NT",,"DARWIN DELIVERY CENTRE" =============================================================== -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/