Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
my @account = qw(34765-22333-333489-99867-22340-23456-3229 XLM8876 AMP +7765 WQP22349); my @chk_acc = split('-',@account); foreach my $checked (@chk_acc) { chomp(); if($checked=~/^(\w{3})(\d{4,7})/ig) { # it should print the accounts starting with letters here print "*$checked*<br>"; }else{ # else the rest of the accounts not starting with any l +etters print"-$checked-<br>"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regular Exp. in foreach loop Help!
by toolic (Bishop) on Feb 25, 2010 at 17:12 UTC | |
|
Re: Regular Exp. in foreach loop Help!
by tilly (Archbishop) on Feb 25, 2010 at 17:56 UTC | |
|
Re: Regular Exp. in foreach loop Help!
by Ratazong (Monsignor) on Feb 25, 2010 at 17:20 UTC | |
|
Re: Regular Exp. in foreach loop Help!
by jwkrahn (Abbot) on Feb 25, 2010 at 17:52 UTC | |
|
Re: Regular Exp. in foreach loop Help!
by cdarke (Prior) on Feb 25, 2010 at 17:34 UTC |