On Fri, 16 Nov 2001, 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?
>
> Ken

$filepath = reverse filepath;
my ($title, undef) = split /\//, $filepath, 2;
$title = reverse $title;


Or, if your supply of whitespace is running low:

$title=reverse shift @{[split(/\//,reverse($filepath),2)]};

But you probably don't want to do that if you'll ever need to look at
this code again. :>

Dave


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

Reply via email to