Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^7: regex syntax and idomatic Perl

by cbeckley (Curate)
on Mar 23, 2017 at 14:44 UTC ( #1185638=note: print w/replies, xml ) Need Help??


in reply to Re^6: regex syntax and idomatic Perl
in thread regex syntax and idomatic Perl

Ah, I think I see (again). So, in the for loop, $_ is an alias to the same memory location as the element in the list being looped over. If that memory location is occupied by something that is semantically an lvalue, then $_ behaves as if it were a C pointer, which is to say, behaves just like the thing it's pointing to. If the memory location is not an lvalue, then $_ does not behave like a C pointer, but still behaves like the thing it's pointing to.
Is that right?

I have to stop trying to understand the mechanics of Perl in terms of C.
<Insert Yoda quote here.>
So, $_ is imbued with the semantic context of the thing that occupies the memory location to which it points. Still thinking in C, clearly ...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1185638]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2020-05-29 01:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (166 votes). Check out past polls.

    Notices?