in reply to Using substr to remove characters
another way might be:#!/usr/bin/perl -w use strict; my $str = "This_is_a_song_.mp3"; $str =~ s/_(\.mp3)$/$1/g; print "$str\n";
... and so on, and so on... :Duse strict; my $str = "This_is_a_song_.mp3"; my ($pre, $post) = split /\./, $str; chop $pre; $str = "$pre.$post"; print "$str\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Using substr to remove characters
by JediWizard (Deacon) on May 09, 2005 at 13:34 UTC |