Your attempted comparison is way off. You're trying to use the filename you want to match against as a regular expression, the result of that comparison you're for some reason trying to compare with the string "s". You need to use the =~ operator to bind a match /^s/ to the variable holding the filename ($fname =~ /^s/; see perlretut). As for the substitution, you should look at the docs for the substitution operator. And unrelated, but you probably want print not printf.
And you might look for some better introductory material (see http://learn.perl.org/ for example).
Update: Actually Regexp Quote-Like Operators in perlop is probably a better source for info on s///.
The cake is a lie.
The cake is a lie.
The cake is a lie.
In reply to Re: How do I do character substitution on strings stored in a variable
by Fletch
in thread How do I do character substitution on strings stored in a variable
by gcebulka
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |