Thread substr_count in perl (29 answers)
Opened by norman at 2004-07-14 14:52

pq
 2004-07-14 20:41
#84309 #84309
User since
2003-08-04
12209 Artikel
Admin1
[Homepage]
user image
jetzt habe ich doch die richtige stelle in perldata gefunden:
      List assignment in scalar context returns the number of
      elements produced by the expression on the right side of
      the assignment:

          $x = (($foo,$bar) = (3,2,1));       # set $x to 3, not 2
          $x = (($foo,$bar) = f());           # set $x to f()'s return count

      This is handy when you want to do a list assignment in a
      Boolean context, because most list functions return a null
      list when finished, which when assigned produces a 0,
      which is interpreted as FALSE.
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. -- Damian Conway in "Perl Best Practices"
lesen: Wiki:Wie frage ich & perlintro Wiki:brian's Leitfaden für jedes Perl-Problem

View full thread substr_count in perl