ghosh123 has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monk, Suppose I have perl script which has no 'use strict'/'use warnings' in it. In that case what is the significance of a 'my' and 'local' variable in it. It is like
#!/usr/bin/perl my $a = 5; local $b = 4;
What are the significance of 'my' and 'local' here. For your information I know about local variables. They work on global (i.e package ) variables, applying 'local' on them localizes their value and restores back their original value once the scope is gone. But in this above scenario how do they(my and local) differ ?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: my and local variable significance in a particular case
by GrandFather (Saint) on Apr 24, 2012 at 05:38 UTC | |
|
Re: my and local variable significance in a particular case
by JavaFan (Canon) on Apr 24, 2012 at 07:33 UTC | |
by Anonymous Monk on Apr 25, 2012 at 03:51 UTC | |
by JavaFan (Canon) on Apr 25, 2012 at 06:22 UTC | |
|
Re: my and local variable significance in a particular case
by NetWallah (Canon) on Apr 24, 2012 at 05:34 UTC | |
|
Re: my and local variable significance in a particular case
by lidden (Curate) on Apr 24, 2012 at 05:40 UTC | |
|
Re: my and local variable significance in a particular case
by tobyink (Canon) on Apr 24, 2012 at 09:31 UTC | |
|
Re: my and local variable significance in a particular case
by brx (Pilgrim) on Apr 24, 2012 at 15:59 UTC |