Mark wrote:
> 
> > If you have Perl installed then you should also have the documentation
> > for Perl installed.  The perlre.pod and perlop.pod documents explain how
> > tr///, y///, s///, and m// work.
> >
> > perldoc perlop
> > perldoc perlre
> 
> I have ActiveState Perl on win2k and the docs are provided in html format.

I don't use Windows but if you open a DOS/console window and type those
commands at the prompt they should display the relevant documents.

C:\>perldoc perlop
C:\>perldoc perlre


> I also use Perldoc.com adn I was over there tonight but couldn't find it.  I
> also notice that I can't search the archives of this list from the URL given
> for the mailing list.

http:[EMAIL PROTECTED]/


> > > $name =~ tr/a-zA-Z0-9-_ .,:;'&$#@!*()?-//cd;
> 
> > If the characters listed are say d-h (defgh) then /c means to
> > transliterate all characters that are not d-h, in other words \x00-c and
> > i-\xFF (tr/d-h//cd == tr/\x00-ci-\xFF//d)
> 
> So does transliterate mean to render the characters into their hex
> equivalent?

In my example hex was used to represent characters that can't be
displayed just like "A", "\x41" and "\101" are all different
representations of the character 'A' and "\t", "\x09", "\011" and "\cI"
are all ways to represent the TAB character.


> Such that in the above line $name is parsed against the
> charater set in pattern1 and any characters not found in that pattern are
> deleted

Correct.

> and all others are now hex?

All others are left unchanged.


> Also, is my assumption correct that =~ works the same as feeding the left
> side of the expession to the right as an argument just the same as one does
> a function.  I'm just wondering if there is some other trickery going on and
> I'm thinking of it improperly...althought the results appear basically the
> same.

=~ binds the tr///, s/// or m// operator to a scalar variable.  Without
the =~ tr///, s/// or m// are bound to the $_ variable.

$scalar =~ s/abc/def/g; # modify the contents of $scalar

$scalar = s/abc/def/g; # modify the contents of $_ store the result
(true or false) in $scalar

($scalar = $_) =~ s/abc/def/g; # copy $_ to $scalar and modify the
contents of $scalar

s/abc/def/g; # modify the contents of $_



John
-- 
use Perl;
program
fulfillment

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

Reply via email to