On Nov 17, Andrea Holstein said:

>Ken Clark wrote:
>> 
>> I want to capture the title of the current song I have running on my box
>> through mpg123 and redirect it to a file. In this process, I don't want
>> the /long/path/to/song but just the song.mp3. Is it possible to capture
>> the song title this way?
>> 
>Hi, another way is:
>
>my ($title) = $path =~ m{ ( [^/]+ ) $ }x;

You could avoid regexes entirely (look who's saying it!):

  my $title = substr $path, rindex($path, '/') + 1;

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **


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

Reply via email to