"Jeff 'Japhy' Pinyan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> On Jul 28, Tara Calishain said:
>
> >At 01:22 PM 7/28/2003, you wrote:
> >
> >>>      What perl function can i use to extract a
> >>> sub-string from a string.
> >>
> >>$string = 'myfile.txt';
> >>
> >>$string =~ m/^(\w+)\.txt$/;
> >
>
> I'd probably do
>
>   my ($prefix) = split /\./, $string;
>
> if I didn't need anything after the first ".".

I'd probably do:

  my $file = 'this.txt.old';
  my ($name) = $file =~ /(.+)\./;

because I probably want everything before the last dot :)

Rob



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to