--- Edson Manners <[EMAIL PROTECTED]> wrote:
> I am having trouble finding a list of formatting characters that deal
> with the backslash and forward slash characters in Perl.
> For example... What does----
> if ($line =~ /^$i\./)
> mean I understand everything except the characters ^$i\./
> What is the significance of these characters?
> I would be much obliged if I can get any response.
Let me explain more than needed, for all who might benefit.
The construct
$line =~
associates the following pattern with the variable $line, so that it
operates on that value, rather than some other such as the default of
$_
The match pattern
/^$i\./
means:
/ this is the default matching character,
and begins the pattern
^ The carat means to "anchor" the pattern at the start of
(in this case) $line.
$i The value of $i is compared to $line
\. a period is usually a matching wildcard character.
the backslash escapes it, saying to use a literal period
/ this is the closing slash, ending the pattern
What this means is "Search from the beginning of $line for the value in
$i, followed by a period".
=====
print "Just another Perl Hacker\n"; # edited for readability =o)
=============================================================
Real friends are those whom, when you inconvenience them, are bothered less by it than
you are. -- me. =o)
=============================================================
"There are trivial truths and there are great Truths.
The opposite of a trival truth is obviously false.
The opposite of a great Truth is also true." -- Neils Bohr
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/