Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Implicit assignment to $_

by arnaud99 (Beadle)
on Feb 26, 2013 at 16:08 UTC ( #1020717=note: print w/ replies, xml ) Need Help??


in reply to Implicit assignment to $_

Hi, I am unsure about what you are trying to achieve here as there is very little of the code.

$_ is a global variable and quite a few places in perl use $_ as the default.

To know more use 'perldoc perlvar' and you will have a good explanation of where and how $_ can be used.

Below is a small program that uses $_ as the default for both the while loop and the print statement.

I hope this helps.

Arnaud.

use strict; use warnings; use autodie; while(<DATA>) { print; } __DATA__ Test A Test B


Comment on Re: Implicit assignment to $_
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (16)
As of 2015-07-29 14:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (263 votes), past polls