in reply to grep flip flop (range operator)
What are you expecting to get with 1 .. /Q/?
The following code prints nothing as well:
However, this does not explain why the last command *does* print something :)
The following code prints nothing as well:
If your match-list is empty, nothing matches, and nothing is printed.use Data::Dump; Data::Dump::dd(1 .. /Q/);
However, this does not explain why the last command *does* print something :)
Edit: Upon further reading, it looks like the range operator isn't parsed in scalar context, as the following does print something: perl -le " print for grep scalar 1 .. /Q/, @ARGV " a b c Q r s
Output: a b c Q r s
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: grep flip flop (range operator)
by Anonymous Monk on Sep 13, 2012 at 07:04 UTC |
In Section
Seekers of Perl Wisdom