On Aug 10, Vineet Pande said:

I faced an example where in a loop:

if (\$base2\)

You probably say

  if (/$base2/) { ... }

The /.../ is a pattern match.  It's shorthand for

  if ($_ =~ /$base2/) { ... }

which treats $base2 like a regular expression (pattern) and tries to find a substring in $_ which matches that pattern. See 'perldoc perlretut' for more information on regexes.

The code was probably something like

  for (@dna) {
    if (/$base2/) {
      ...
    }
  }

which iterates over the values in @dna and does something for each value that contains $base2.

--
Jeff "japhy" Pinyan         %  How can we ever be the sold short or
RPI Acacia Brother #734     %  the cheated, we who for every service
http://japhy.perlmonk.org/  %  have long ago been overpaid?
http://www.perlmonks.org/   %    -- Meister Eckhart

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to