[Omaha.pm] RE: wrong

Patrick Sean Baker pbaker at omnihotels.com
Thu Aug 26 18:59:11 CDT 2004


I actually like your new way:

($lname, $fname) = m#^(.*?)[,/]\s+(.*)$#;

Somehow, it's much easier to read for me.....

> 
> On Aug 26, 2004, at 11:35 AM, Jay Hannah wrote:
> >> my ($lname, $fname) = ($res->get_gst_name =~ /^(\w+)(,|\/)(\w+)
$/);
> >>
> >> what's wrong with this?
> >
> >
> > Ya. That's bad. The , or / will be stuck in $fname.
> >
> > Perhaps:   #^(.*?)[,/](.*)$#
> 
> Whoops. I was told that doesn't work. Probably because if you choose 
to 
> change // to ## you have to specify the s (substitute) or m (match) 
> explicitly.
> 
> $ cat j.pl
> #!/usr/bin/perl
> $_ = "Hannah, Jay";
> ($lname, $fname) = m#^(.*?)[,/](.*)$#;
> print "[$lname][$fname]\n";
> 
> $ ./j.pl
> [Hannah][ Jay]
> 
> That's better. But still not right, since the leading space in 
$fname 
> doesn't go away.
> 
> What this problem needs is Test::Simple and 50 tests. -grin-
> 
> j
> 
> _______________________________________________
> Omaha-pm mailing list
> Omaha-pm at mail.pm.org
> http://www.pm.org/mailman/listinfo/omaha-pm
> 
> 

Patrick Baker
Programmer
(402) 952-6508
pbaker at omnihotels.com


More information about the Omaha-pm mailing list