Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: use of $*

by ikegami (Pope)
on Aug 01, 2014 at 11:50 UTC ( #1095889=note: print w/replies, xml ) Need Help??


in reply to use of $*

It was the same as using /m on all your match and substitution operators, except it overrode instructions to turn /m off.

For example, qr/foo$/ shouldn't match "foo\nbar\n" even if it's used as /$re/m.

$ perl5010 -le' $re = qr/foo$/; print $re; print "foo\nbar\n" =~ /$re/m ?1:0 ' (?-xism:foo$) # -m: Turn /m off. 0

But it did before 5.10

$ perl5008009 -le' $re = qr/foo$/; print $re; print "foo\nbar\n" =~ /$re/m ?1:0 ' (?-xism:foo$) 1 # Matched as if /m was on for the subpattern.

This was fixed, but there was no way of fixing $* which had the same error.

$ perl5008009 -le' $re = qr/foo$/; print $re; local $* = 1; print "foo\nbar\n" =~ /$re/ ?1:0 ' (?-xism:foo$) 1

So it was dropped.

Replies are listed 'Best First'.
Re^2: use of $*
by millan123 (Initiate) on Aug 01, 2014 at 12:49 UTC
    can you pls let me know what does this code do?
    $* = 1
      See Re: use of $* for an answer.
      لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1095889]
help
Chatterbox?
[Lady_Aleena]: Has anyone here ever use pcregrep? I can't seem to get the --include regex right. --include=*.p[lm] works in grep but not pcregrep.
[erix]: to lift your spirits, here is some more happy Randy news...
[Lady_Aleena]: The reason I would like to use pcregrep is because it can do multiline searches supposedly.
[perldigious]: What are your criteria for looking Tanktalus? What things must a job have for you to consider it? And where are you in your career? Start, middle, or end?
[erix]: are there any regex-engines that do not do multiline?
[Lady_Aleena]: erix, grep doesn't.
[Lady_Aleena]: Linux grep that is...
[Lady_Aleena]: $ grep --include=*.p[lm] -Ern 'get_(array|hash| data)' does not do multiline search.
[Discipulus]: focus on Perl LA; you can already search multiline patterns
[erix]: grep is a program, not a regex-engine

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (12)
As of 2017-05-23 19:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?