Lingua::Pangram
Marty Pauley
perl.belfast at kasei.com
Wed Jan 23 07:51:56 CST 2002
On Wed Jan 23 03:48:51 2002, Russell Matbouli wrote:
> A minute's thought would have told me this :)
>
> > sub pangram {
> > my $self = shift;
> > my $string = shift;
> >
> > for ('a'..'z') {
> > return 0 unless $string =~ /$_/;
> > }
> >
> > return 1;
> > }#pangram
>
> Much nicer. Easier to read, no extra variables either.
But that doesn't work with uppercase letters in your pangram. :-)
This looks like a nice golf challenge...
To start, a modified version of Russell's code at 74 strokes:
perl -wnle 'sub p{for("a".."z"){return()unless$_[0]=~/$_/i}1}p($_)&&print'
Your entries should behave in the same way as the above example: it
should print any input lines that are pangrams.
Have fun!
--
Marty
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 220 bytes
Desc: not available
Url : http://mail.pm.org/archives/belfast-pm/attachments/20020123/8811b8e4/attachment.bin
More information about the Belfast-pm
mailing list