in reply to The (split) answer
in thread Probably silly regex question / not so silly regex question

While we are doing high level manipulations, you can also do:
($name,$ext) = reverse map {scalar reverse} (split /\./, (reverse $fil +ename), 2);

Ciao,
Gryn

Replies are listed 'Best First'.
RE: Yet Another The (split) answer
by Adam (Vicar) on Aug 02, 2000 at 02:14 UTC
    Or:
    my( $name, $ext ); { my @chunks = split/\./, $filename; $ext = pop @chunks; $name = join '.', @chunks; }
    If you don't like reverse for some reason.

    Actually I really liked gryng's answer... I was just trying to thing of another way to do it using split.

    For them that like one-liners:

    my( $ext, $name )=(@_=split/\./, $filename and pop @_, join '.', @_);