perl q(..) range operator

there are 2 largely unrelated operators:

  • list range operator,
  • scalar range operator

#1 most common usage (list context) iterates over a range of integers or strings, similar to python xrange(). [1] has clear examples.

#2 (possibly more powerful) usage is during text file line-by-line processing. The operators selects a continuous chunk of lines.

Overall, [1] has too many technicalities to obscure the key, useful features.

Unintuitively, this is considered scalar context [1] has useful example, but need to understand the basics first.

[1] http://perldoc.perl.org/perlop.html#Range-Operators

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s