xxxmenger 发表于 2018-8-31 09:49:25

Perl Learning - 8 (I/O, <>, print(), @ARGV)

foreach(){   # list context  print "I saw $_";
  }
  while() is scalar context, once it gets one line the line be will be printed. Then gets another line, one line a time.
  foreach() is list context, so it will gets all lines at a time, then print one line at a time going through elements.

页: [1]
查看完整版本: Perl Learning - 8 (I/O, <>, print(), @ARGV)