Nyimi Jose wrote:
> 
> > From: david [mailto:[EMAIL PROTECTED]]
> >
> > sub fix_it{
> >         my $s = shift;
> >         $s =~ s#(.)#chr(ord($1)/2)#ge;
> 
> I did know that it was possible to use # character instead of the / one,
> while substution. I understand why you use it :-) (because of division
> operator). So my question is :
> Are there others characters that I can use in substitution statement
> instead of the "normal" / char ?

Yes.

perldoc perlop
[snip]
               If "/" is the delimiter then the initial `m' is
               optional.  With the `m' you can use any pair of
               non-alphanumeric, non-whitespace characters as
               delimiters.  This is particularly useful for
               matching path names that contain "/", to avoid LTS
               (leaning toothpick syndrome).  If "?" is the
               delimiter, then the match-only-once rule of `?PAT­
               TERN?' applies.  If "'" is the delimiter, no
               interpolation is performed on the PATTERN.
[snip]
               Any non-alphanumeric, non-whitespace delimiter may
               replace the slashes.  If single quotes are used,
               no interpretation is done on the replacement
               string (the `/e' modifier overrides this, how­
               ever).  Unlike Perl 4, Perl 5 treats backticks as
               normal delimiters; the replacement text is not
               evaluated as a command.  If the PATTERN is delim­
               ited by bracketing quotes, the REPLACEMENT has its
               own pair of quotes, which may or may not be brack­
               eting quotes, e.g., `s(foo)(bar)' or
               `s<foo>/bar/'.


This applies to all the quote and quote-like operators (m//, s///, q//,
qq//, qw//, qr//, and qx//) and the transliteration operators (tr/// and
y///.)


John
-- 
use Perl;
program
fulfillment

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

Reply via email to