On Thursday 21 October 2004 01:07 pm, [EMAIL PROTECTED] wrote:
> yeah, yeah, yeah, here she is:
>
> $DS{$chr}{name} =~ m/([a-z]+)\-(.+)/;
> $firsthalf = $1;
> $secondhalf = $2;
>
> > I'm not particularly good with perl.
Even better, just use the native split function:
perldoc -f split
split /PATTERN/,EXPR,LIMIT
so:
my ($firsthalf, $secondhalf) = split ( /-/, $DS{$chr}{'name'}, 2);
This is cleaner since you dont' need the heftier regular expression (while
the /-/ is a regex, it's easier), and it's easier to see the assignments.
Plus, one line.
--
--
Jayce^
pgpILoVvrRmxu.pgp
Description: signature
____________________ BYU Unix Users Group http://uug.byu.edu/ ___________________________________________________________________ List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list
