From: Chris Nehren <c.nehren/beginn...@shadowcat.co.uk>
> On Wed, Aug 29, 2012 at 09:59:22 -0700 , John SJ Anderson wrote:
> > On Wednesday, August 29, 2012 at 9:46 AM, Ashwin Rao T wrote:
> > > 1)Check if IP address is in the range 172.125.1.0 and 172.125.25.0 using 
> > > only
> > > return functions & regular expressions in Perl.
> > > 2)Check if the name is valid (has atleast 3 letters and one vowel) using 
> > > only
> > > return functions and regular expressions in Perl.
> > > 3)Check if email address is valid using only return functions and regular
> > > expressions in Perl.
> > > 4)Convert the number into words using only return functions and regular
> > > expressions in Perl. (15 => one five)
> > >
> > >
> > I'm pretty sure the instructor in the class you're taking would prefer
> > that you do your own homework…
>
> I'm pretty sure the instructor doesn't know Perl or regular expressions
> if they're asking for those things to be done with only regex. At least
> three items on that list are best done with CPAN modules. My advice is to
> drop the class now and get a refund, if at all possible.

The fact that there's a module for something doesn't necessarily mean
it's not a good homework assignment. Especially if you restrict both
the allowed constructs and the task.

Now in this case the 3) is surely ill defined ... even if "valid"
meant just "syntacticly valid" the RFC is crazy enough to make this
nondoable. Unless of course at the class they spoke about a specific
definition of valid.

It might be a trick question though with the best answer similar to
"a simple check might look like this: /.../, but it will allow some
invalid addresses and reject some rare valid ones. A more restrictive
solution still matching the vaste majority of email addresses "in the
wild" would be /... .../. For validation according to the RFT, module
X::Y may be used."

Actually ... what percentage of websites doing email address
validation in their forms do you think validate according to the RFC?
0.001%?

Jenda
===== je...@krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to