[Chicago-talk] scalar question
imranjj at gmail.com
Mon Jan 31 14:01:43 PST 2011
split is one way
But if you prefer regex:
my ($pref,$suff,$ext) = ($fl1 =~ m/(\w+)-(\w+)\.(\w+)/);
On Mon, Jan 31, 2011 at 3:40 PM, Richard Reina <richard at rushlogistics.com>wrote:
> I know I should no this, but I don't and was wondering if someone could
> enlighten me. I have some scalars that represent filenames and look like
> my $fl1=3321-1.pdf
> my $fl2=3321-2.pdf
> my $fl3=3432-1.pdf
> I can get everything before the "-" like this:
> $fl2=~s/\-.*//; # get the root of the filename
> but how can I do it without changing the contents of the original scalar?
> I'd like to put the result directly in a new scalar.
> $root_name= $f12=~s/\-.*//; # get the root of the filename
> Richard Reina
> Rush Logistics, Inc.
> Watch our 3 minute movie:
> Chicago-talk mailing list
> Chicago-talk at pm.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Chicago-talk