

They are used in an expression to precisely define which strings should be matched and replaced. The g and i modifiers may both be specified in the same expression, to perform case-insensitive global substitution, for example: s/silly/foolish/gi MetacharactersĪ metacharacter is a character (or characters) with a special meaning. would substitute ' SILLY', ' Silly', or ' siLLY' with ' foolish'. To perform matching in a case-insensitive manner, add an i at the end of the substitution expression. would substitute every occurrence of ' silly' with ' foolish', no matter how many times it occurs. To perform global substitution (that is, to substitute expr2 for expr1 as many times as expr1 occurs), add the modifier g at the end of the substitution expression. would substitute the first occurrence of the string ' silly' with the string ' foolish'. where expr1 is an expression describing the string you want to replace, and expr2 is an expression describing the string you want to replace. To substitute one expression for another, the form of perlexpr is: s/ expr1/ expr2/ Perl regular expressions is a complex and nuanced subject, but here is a brief overview: Substitution The perlexpr argument is a regular expression as used by the Perl programming language. No Action: show what files would be renamed. Verbose: print names of files successfully renamed. Syntax rename perlexpr Options -v, -verbose If no file names are given on the command line, file names are read via standard input.

If a specified file is not modified by the expression, it is not renamed. Rename renames the named files according to the regular expression perlexpr.
