Re: script to match a valid email id

2014-07-10 Thread David Precious
On Thu, 10 Jul 2014 11:54:07 -0700 Bob goolsby wrote: > Nota Bene: > xxx@zzz.www IS NOT the only valid format for an email > address In this case, you really need to rethink your objection > to using the proper CPAN module *This*. Use the well-trusted, battle-tested CPAN module. Whate

Re: List::MoreUtils with array of arrays not working

2014-07-10 Thread Jim Gibson
On Jul 10, 2014, at 11:50 AM, Natxo Asenjo wrote: > On Thu, Jul 10, 2014 at 1:00 AM, Jim Gibson wrote: > > On Jul 9, 2014, at 2:58 PM, Natxo Asenjo wrote: > > On Wed, Jul 9, 2014 at 10:35 PM, Jim Gibson wrote: > > On Jul 9, 2014, at 1:20 PM, Natxo Asenjo wrote: > > In order to use the hash m

Re: script to match a valid email id

2014-07-10 Thread Mike
That's a lot of regex. On 7/10/14, 2:25 PM, Ron Bergin wrote: Sunita Pradhan wrote: I do not want to use Cpan modules . -Sunita What do you have against using a cpan module? If you don't want to use the module, then why not simply copy/use the regex that it uses to do the validation? $RFC8

RE: script to match a valid email id

2014-07-10 Thread Ron Bergin
Sunita Pradhan wrote: > I do not want to use Cpan modules . > > -Sunita > What do you have against using a cpan module? If you don't want to use the module, then why not simply copy/use the regex that it uses to do the validation? $RFC822PAT = <<'EOF'; [\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:

Re: script to match a valid email id

2014-07-10 Thread Розанда ЧУП
the "r...@i.frys.com" address may not be matched by my regexp, because here two dots after @. Here it is more universal: /\A.+?\@.+?\..+\Z/ 10.07.2014, 21:43, "Sunita Pradhan" : > I do not want to use Cpan modules . > > -Sunita > >> Date: Thu, 10 Jul 2014 11:33:24 -0700 >> Subject: Re: script to

Re: script to match a valid email id

2014-07-10 Thread Розанда ЧУП
use the regular expression for checking @ and dot and length of some address' parts:) for example, try this: #!/usr/bin/perl use warnings; use strict; use 5.014; print "enter the email address "; while (<>) { if(/\A.{4,15}\@.+?\..{2,3}\Z/) { print "it's correct\n"; }

Re: script to match a valid email id

2014-07-10 Thread Andy Bach
On Thu, Jul 10, 2014 at 1:42 PM, Sunita Pradhan < sunita.pradhan.2...@hotmail.com> wrote: > I do not want to use Cpan modules . > Depending upon how "correct" you want to be, it's not easy: http://stackoverflow.com/questions/210945/what-would-be-a-globally-accepted-regular-expression-to-match-e-

Re: script to match a valid email id

2014-07-10 Thread Bob goolsby
Then take a look at the Owl (Regular Expressions) book. The first appendix, if I recall correctly) has an regex that will validate an e-mail address. The regex is something over 2,000 characters long. Nota Bene: xxx@zzz.www IS NOT the only valid format for an email address In this case,

Re: List::MoreUtils with array of arrays not working

2014-07-10 Thread Natxo Asenjo
On Thu, Jul 10, 2014 at 1:00 AM, Jim Gibson wrote: > > On Jul 9, 2014, at 2:58 PM, Natxo Asenjo wrote: > > On Wed, Jul 9, 2014 at 10:35 PM, Jim Gibson > wrote: > > On Jul 9, 2014, at 1:20 PM, Natxo Asenjo wrote: > > In order to use the hash method of determining uniqueness, you must > convert

Re: script to match a valid email id

2014-07-10 Thread SSC_perl
On Jul 10, 2014, at 11:30 AM, Sunita Pradhan wrote: > I want to write a script which will verify a valid email address . > Could anybody give some ideas , how to write a pattern for this ? Sunita, I've used Email::Valid for this and it works nicely. And the code to use it is pretty easy

RE: script to match a valid email id

2014-07-10 Thread Sunita Pradhan
I do not want to use Cpan modules . -Sunita > Date: Thu, 10 Jul 2014 11:33:24 -0700 > Subject: Re: script to match a valid email id > From: r...@i.frys.com > To: sunita.pradhan.2...@hotmail.com > CC: beginners@perl.org > > Sunita Pradhan wrote: > > I want to write a script which will verify a

Re: script to match a valid email id

2014-07-10 Thread Ron Bergin
Sunita Pradhan wrote: > I want to write a script which will verify a valid email address . > Could anybody give some ideas , how to write a pattern for this ? > > -Sunita > Take a look at the Email::Valid module. http://search.cpan.org/~rjbs/Email-Valid-1.194/lib/Email/Valid.pm -- To unsubscrib

script to match a valid email id

2014-07-10 Thread Sunita Pradhan
I want to write a script which will verify a valid email address . Could anybody give some ideas , how to write a pattern for this ? -Sunita

RE: Creating a hash of arrays from

2014-07-10 Thread Sunita Pradhan
You can try using a reference instead of hash like : -- my $entries; my($state, $zipcodes); while (my $line = ) { chomp $line; ($state, $zipcodes) = split (/=/, $line); push( @{ $entries->{$state} }, split( /,/,$zipcodes) ) } print Dumper ($entries); __DATA__ AK=995,

Re: Creating a hash of arrays from

2014-07-10 Thread SSC_perl
On Jul 10, 2014, at 9:00 AM, Ron Bergin wrote: > my($state, @zipcodes) = split /[=,]/, $line; Interesting concept, the multiple split. I'd be interested in knowing how Perl knows to give the singular value on the left of the "=" to $state and all other values split on the "," to @zipcod

Re: Creating a hash of arrays from

2014-07-10 Thread Ron Bergin
Ron Bergin wrote: > Others have already pointed what you were doing wrong, so I'll point out > something else. > > Instead of using 2 separate split statements, I'd use a single split > statement to assign $state and a @zipcodes array. > > use 5.010; > use strict; > use warnings; > use Data::Dumpe

Re: Creating a hash of arrays from

2014-07-10 Thread Ron Bergin
SSC_perl wrote: > If someone could explain what I'm doing wrong, I'd appreciate it. I > just > can't see it. > > Thanks, > Frank > > -- > > use strict; > use warnings; > use 5.010; > > use Data::Dumper; > > my %entries; > > while (my $line = ) { > chomp $line;

Re: Creating a hash of arrays from

2014-07-10 Thread Nathan Hilterbrand
Hi Frank On 07/10/2014 11:02 AM, SSC_perl wrote: On Jul 10, 2014, at 7:14 AM, Nathan Hilterbrand wrote: $entries{$state} = [ (split /,/ => $zipcodes) ]; Thanks, Nathan. The line above caught my eye. It's interesting to see that you don't need both 'push' and 'split' to populate th

Re: Creating a hash of arrays from

2014-07-10 Thread SSC_perl
On Jul 10, 2014, at 7:14 AM, Nathan Hilterbrand wrote: > $entries{$state} = [ (split /,/ => $zipcodes) ]; Thanks, Nathan. The line above caught my eye. It's interesting to see that you don't need both 'push' and 'split' to populate the hash. Could you explain a little about wh