Charles DeRykus writes:
> You could also simplify the closure since @tasks is in the closure's
> lexical scope, eg,
>
> my $report_static = sub { print $tasks[$iter++]; ... };
>
> foreach $task (@tasks) {
> if (...)
> $rep
er++];
>...
>
> #MAIN_CODE START
>
> foreach $task (@tasks) {
> if ( )
>$report_static->(\@tasks);
>...
> else
> $report_dynamic->(\@tasks);
> ...
> I expect the large code I have written will now work
> after applying the following quote from your site:
>
> > However, this is bad form in Perl, and the preferable way is to declare
> > all the variables when they are first used, and at the innermost scope
> > wher
ritten will now work
after applying the following quote from your site:
> However, this is bad form in Perl, and the preferable way is to declare
> all the variables when they are first used, and at the innermost scope
> where they should retain their value. This will allow to keep trac
Hi Martin,
here are some comments on your code in addition to what Uri said.
On Fri, 27 Feb 2015 22:24:52 -0600
"Martin G. McCormick" wrote:
> Brock Wilcox writes:
> > I'm afraid a bit more context is needed to identify the problem. Could you
> > post your entire bit of code into a gist or past
On Fri, Feb 27, 2015 at 8:24 PM, Martin G. McCormick
wrote:
> Brock Wilcox writes:
>> I'm afraid a bit more context is needed to identify the problem. Could you
>> post your entire bit of code into a gist or pastebin or something for us
>> to
>> see?
>
> I'll do better than that. This is a
On 02/27/2015 11:24 PM, Martin G. McCormick wrote:
Brock Wilcox writes:
I'm afraid a bit more context is needed to identify the problem. Could you
post your entire bit of code into a gist or pastebin or something for us
to
see?
I'll do better than that. This is a script which is
strippe
Brock Wilcox writes:
> I'm afraid a bit more context is needed to identify the problem. Could you
> post your entire bit of code into a gist or pastebin or something for us
> to
> see?
I'll do better than that. This is a script which is
stripped of everything but the problem code. It is 2
select which
> element in @tasks was used and the anonymous subroutine would do
> what it needed to do just as it had done when it was all in
> main.
>
> I am familiar with declaring my $variable; or our
> $variable; if one shares variables between subroutines but I
&
$variable; or our
$variable; if one shares variables between subroutines but I
just assumed that in an anonymous subroutine, one was still
working with the same scope as the variables in the routine that
called the subroutine.
Thanks for any constructive suggestions.
Martin McCormick
--
or
$new_name. 284 was relying on failure being null and failing tests,
specifically at 280.
I tried
if (my @old = @$($template{uname}){$new_name}) {
but it the same error at 283 as the first error (the version with scope, not
statement).
The if test at 284 checks if the user has speci
I think I figured out one thing from my earlier message:
print '$template{uname}{ross} =' , $template{uname}{ross}, "\n";
#$template{uname}{ross} =ARRAY(0x20f41d8)
# I'm still surprised this worked. Somehow we've gone 2 levels down with one $.
print '${$template{uname
On Mon, Oct 13, 2014 at 1:04 AM, Boylan, Ross wrote:
> perl -c adduser gives its first error as
> "my" variable $new_uid masks earlier declaration in same scope at adduser
> line 283.
> First, it doesn't seem to me I'm declaring the variable at all at 283. I
&
perl -c adduser gives its first error as
"my" variable $new_uid masks earlier declaration in same scope at adduser line
283.
First, it doesn't seem to me I'm declaring the variable at all at 283. I
suppose it could be an implicit declaration if there wasn't a previous
Yeah, I was going to suggest ctags. If you're using vim there's no good
plugin for ctags (you'll try and I couldn't blame you but when vim starts
blowing up make that the first plugin you disable).
On Apr 26, 2013 4:13 AM, "Luca Ferrari" wrote:
> I use Emacs, so etags seems a natural choice for j
I use Emacs, so etags seems a natural choice for jumping across code.
Luca
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/
On 04/25/13 10:18, Jovan Trujillo wrote:
> I was just browsing through ack the other day. Have you checked that out?
Same here I use a Vim plugin ack.
--
\0/ Hobbestigrou
site web: erakis.im
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h..
gt; to read and write code).
>
>
>
> - Original Message -
> From: kavita kulkarni
> To: beginners@perl.org
> Cc:
> Sent: Thursday, 25 April 2013 8:32 PM
> Subject: Perl scope like cscope
>
> Hi,
> This could be naive.
> I use perl on linux and find
I too looking for this... and later on moved to Padre, the Perl IDE (easy to
read and write code).
- Original Message -
From: kavita kulkarni
To: beginners@perl.org
Cc:
Sent: Thursday, 25 April 2013 8:32 PM
Subject: Perl scope like cscope
Hi,
This could be naive.
I use perl on linux
I was just browsing through ack the other day. Have you checked that out?
Ack: http://beyondgrep.com/
- Jovan
On Thu, Apr 25, 2013 at 8:02 AM, kavita kulkarni
wrote:
> Hi,
> This could be naive.
> I use perl on linux and find it difficult to navigate quickly through the
> scripts.
> I wonder i
Hi,
This could be naive.
I use perl on linux and find it difficult to navigate quickly through the
scripts.
I wonder if there is something like cscope (which is very handy to
navigate C code.)
What are the standard practises in perl apart from normal grep or find like
utilities?
Any pointers wil
Chris Stinemetz wrote:
Why does this short program only seem to capture the last line of
input in the @array, but when I put the for loop inside the while loop
all lines of input are available in @array.
I thought by declaring the @array outside the while loop would make
all of its contents avai
On 12-06-05 08:31 PM, Steve Bertrand wrote:
On 05/06/2012 3:49 PM, Shawn H Corey wrote:
On 12-06-05 05:43 PM, Bill Stephenson wrote:
Maybe this is what you need?
#!/usr/bin/perl
use warnings;
use strict;
my @array;
while ( my $line = ) {
chomp $line;
push (@array = split(/\s+/, $line,-1));
On 05/06/2012 6:31 PM, Steve Bertrand wrote:
On 05/06/2012 3:49 PM, Shawn H Corey wrote:
On 12-06-05 05:43 PM, Bill Stephenson wrote:
Maybe this is what you need?
#!/usr/bin/perl
use warnings;
use strict;
my @array;
while ( my $line = ) {
chomp $line;
push (@array = split(/\s+/, $line,-1));
On 05/06/2012 3:49 PM, Shawn H Corey wrote:
On 12-06-05 05:43 PM, Bill Stephenson wrote:
Maybe this is what you need?
#!/usr/bin/perl
use warnings;
use strict;
my @array;
while ( my $line = ) {
chomp $line;
push (@array = split(/\s+/, $line,-1));
push @array, [ split /\s+/, $line, -1 ];
I
On 12-06-05 05:43 PM, Bill Stephenson wrote:
Maybe this is what you need?
#!/usr/bin/perl
use warnings;
use strict;
my @array;
while ( my $line = ) {
chomp $line;
push (@array = split(/\s+/, $line,-1));
push @array, [ split /\s+/, $line, -1 ];
}
for my $item ( @array ) {
print $i
Maybe this is what you need?
#!/usr/bin/perl
use warnings;
use strict;
my @array;
while ( my $line = ) {
chomp $line;
push (@array = split(/\s+/, $line,-1));
}
for my $item ( @array ) {
print $item,"\n";
}
Kindest Regards,
Bill Stephenson
On Jun 5, 2012, at 4:15 PM, Chris Stinemetz wr
On Tue, Jun 5, 2012 at 4:15 PM, Chris Stinemetz wrote:
> Why does this short program only seem to capture the last line of
> input in the @array, but when I put the for loop inside the while loop
> all lines of input are available in @array.
>
> while ( my $line = ) {
> chomp $line;
> @array
Why does this short program only seem to capture the last line of
input in the @array, but when I put the for loop inside the while loop
all lines of input are available in @array.
I thought by declaring the @array outside the while loop would make
all of its contents available once all the lines
D wrote:
I ran into something that I need help understanding. In the attached
script, subroutine file_proc1 converts all elements of @molec to
undef, while file_proc2 does not. adjusting file_proc1 to first slurp
the file into an array "fixes it". My best guess (via dum_sub) is
that the subrou
I ran into something that I need help understanding. In the attached
script, subroutine file_proc1 converts all elements of @molec to
undef, while file_proc2 does not. adjusting file_proc1 to first slurp
the file into an array "fixes it". My best guess (via dum_sub) is
that the subroutine is cro
On 11-01-27 11:33 PM, Raymond Wan wrote:
Oddly enough, when I run B::Xref through my scripts, I get
"segmentation faults" I don't know if I'm using it incorrectly -- but
on a simple Perl file, it works ok. And of course, it works ok with
your one liner above.
I get the same thing, even on sma
Hi Charles,
On Thu, Jan 27, 2011 at 20:26, C.DeRykus wrote:
> On Jan 27, 1:51 am, r@aist.go.jp (Raymond Wan) wrote:
>> I was wondering if there is a way for Perl to give me a warning if I
>> redeclare a variable in a different scope (and thus masking the outer
>> one).
On Jan 27, 1:51 am, r@aist.go.jp (Raymond Wan) wrote:
> Hi all,
>
> I was wondering if there is a way for Perl to give me a warning if I
> redeclare a variable in a different scope (and thus masking the outer
> one). Just spent some time debugging this (which was obviously not
Hi all,
I was wondering if there is a way for Perl to give me a warning if I
redeclare a variable in a different scope (and thus masking the outer
one). Just spent some time debugging this (which was obviously not my
intention to give two variables the same name)...and I guess it is a
silly
n the main:: scope as local variables.
Use a hash.
--
Ruud
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/
retty ugly. Is there a way to import my value
> > definitions int variables in a sub or another module and have them
> > visible in the main:: scope as local variables.
>
> I once wrote a simple document for it,
> see:http://home.arcor.de/pangj/share_variables_between_perl_scri
nother module and have them
> visible in the main:: scope as local variables.
>
I once wrote a simple document for it, see:
http://home.arcor.de/pangj/share_variables_between_perl_scripts.txt
HTH.
--
Jeff Peng
Email: jeffp...@netzero.net
Skype: compuperson
--
To unsubscribe, e-m
I have a program that requests many config values from an ini file
using Config::IniFiles. I import all of these values into my main::
script but it's pretty ugly. Is there a way to import my value
definitions int variables in a sub or another module and have them
visible in the main:: sco
please don't top post...
On Thu, Apr 23, 2009 at 2:18 PM, Vance E. Neff wrote:
> Well it turns out that error was caused by some other problem. I did
> not realize that "our" was not a function. So you can't do something
> like this:
> our $variable = "value1" if (something is true);
> our $
Original Message -
From: "David Shere"
To: "itshardtogetone"
Cc:
Sent: Tuesday, February 10, 2009 3:29 AM
Subject: Re: question on 2 sub modules on the same scope
What is an a_ctr, anyway? :)
Thanks everyone for the help.
ctr is a short form for counter, so
On Tue, 2009-02-10 at 02:55 +0800, itshardtogetone wrote:
> Hi,
> Looking at the script below, can someone explain why the final output is
> "Final = 1" instead of "Final = 5".
> I thought at the end of the while loop, $a_ctr is 5, this value is then read
> by the sub module &data() and this valu
itshardtogetone wrote:
Hi,
Hello,
Looking at the script below, can someone explain why the final output
is "Final = 1" instead of "Final = 5".
I thought at the end of the while loop, $a_ctr is 5, this value is
then read by the sub module &data() and this value of 5 is then passed
on to sub pu
Hi,
Looking at the script below, can someone explain why the final output is "Final
= 1" instead of "Final = 5".
I thought at the end of the while loop, $a_ctr is 5, this value is then read by
the sub module &data() and this value of 5 is then passed on to sub publish
before its being printed ou
Eric Krause wrote:
Hello all,
Hello,
I have two quick questions that I would love some help on. I have looked
at the manual (Programming Perl) and I didn't get it, hence my email.
Question 1 - How can I make variables in a function (subroutine) global
(accessible from other functions)?
A
On Mon, 2008-12-22 at 15:18 -0700, Eric Krause wrote:
> Hello all,
> I have two quick questions that I would love some help on. I have looked
> at the manual (Programming Perl) and I didn't get it, hence my email.
>
> Question 1 - How can I make variables in a function (subroutine) global
> (acc
Hello all,
I have two quick questions that I would love some help on. I have looked
at the manual (Programming Perl) and I didn't get it, hence my email.
Question 1 - How can I make variables in a function (subroutine) global
(accessible from other functions)?
Question 2 - I am trying to con
From: "Chas. Owens" <[EMAIL PROTECTED]>
> On Tue, Dec 2, 2008 at 09:23, Chas. Owens <[EMAIL PROTECTED]> wrote:
> > On Tue, Dec 2, 2008 at 09:11, Deviloper <[EMAIL PROTECTED]> wrote:
> >> Hi!
> >>
> >> Is there a special variable o
On Tue, Dec 2, 2008 at 09:23, Chas. Owens <[EMAIL PROTECTED]> wrote:
> On Tue, Dec 2, 2008 at 09:11, Deviloper <[EMAIL PROTECTED]> wrote:
>> Hi!
>>
>> Is there a special variable or trick to get the name of the current scope or
>> subroutine name?
>>
On Tue, Dec 2, 2008 at 09:11, Deviloper <[EMAIL PROTECTED]> wrote:
> Hi!
>
> Is there a special variable or trick to get the name of the current scope or
> subroutine name?
>
> Thanks,
> B.
>
The caller* function will tell you information about the call stack
(
Hi!
Is there a special variable or trick to get the name of the current scope or
subroutine name?
Thanks,
B.
On Tuesday 06 November 2007 00:24, Gunnar Hjalmarsson wrote:
> John W . Krahn wrote:
> > On Sunday 04 November 2007 18:06, Mike Martin wrote:
> >> sub run_cmd { return print
> >
> > print() returns either true or false. Why are you returning this
> > value from your sub?
> >
> >> span( { -class =>
John W . Krahn wrote:
On Sunday 04 November 2007 18:06, Mike Martin wrote:
sub run_cmd { return print
print() returns either true or false. Why are you returning this value
from your sub?
span( { -class => 'place_cmd' }, submit( -name => 'action',
-value => shift ) ), p };
...
run_cmd(
On Sunday 04 November 2007 18:06, Mike Martin wrote:
>
> Hi
Hello,
> I have the following script
>
> #!/usr/bin/perl -w
> use CGI qw/:standard/;
> use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
> use strict;
> use File::Basename;
>
> our $list;
> sub run_cmd { return print
print() returns
Ah, now there's a lexical scalar named $list! But that's a lexical,
and you wanted to update a global scalar named $list. See what happens
when you give every variable the same name? Maybe you should use
descriptive names for your variables, but in any case don't name a
lexical with the
Hi I have the following script
#!/usr/bin/perl -w
use CGI qw/:standard/;
use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
use strict;
use File::Basename;
our $list;
sub run_cmd {return print
span({-class=>'place_cmd'},submit(-name=>'action', -value=>shift)),p};
my %opts=(entry=>\&entry,
print1
From: "Siva Prasad" <[EMAIL PROTECTED]>
> while(<$FILE_H>)
>
> {
>
> next unless /()/;
>
> my @Rows=grep(/()/,<$FILE_H>);
>
> return(@Rows);
use HTML::TableExtract;
Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed
t
the return(). Are you telling us that it
doesn't warn you about that? Nevertheless, the unreachable close()
isn't a problem; since $FILE_H is a lexical variable, it's auto-closed
when it goes out of scope. So I'd either put the close() before the
return(), or omit it altogether.
Hi Gurus,
I got the mistake which I was doing.
Thanks a lot
PP.
_
From: Siva Prasad [mailto:[EMAIL PROTECTED]
Sent: Monday, October 22, 2007 8:01 PM
To: 'beginners@perl.org'
Subject: problem with variable scope
Hi Gurus,
I have written a packag
On 10/22/07, Siva Prasad <[EMAIL PROTECTED]> wrote:
>
> while(<$FILE_H>)
>
> {
>
> next unless /()/;
>
> my @Rows=grep(/()/,<$FILE_H>);
>
> return(@Rows);
>
> close $FILE_H;
>
> }
>
Well,the first error I have noticed,you have lost a "}" in the code above.
Have you run `perl -c parseSite.pm` befor
Hi Gurus,
I have written a package as below.
__PACKAGE
package parseSite;
use strict;
use warnings;
sub new {
my $class = shift;
my $Input_file=shift;
On 10/2/07, Beginner <[EMAIL PROTECTED]> wrote:
snip
> > > $| = 1;
>
> I wasn't aware this only applied to STDOUT. My log messages all
> appear at once, when the script has exited and I was hoping for some
> 'realtime' messages.
snip
It applies to stdout because it is the currently selected fileh
On 10/2/07, Bob McConnell <[EMAIL PROTECTED]> wrote:
snip
> > > > $| = 1;
> >
> > I wasn't aware this only applied to STDOUT. My log messages all
> > appear at once, when the script has exited and I was hoping for some
> > 'realtime' messages.
>
> It used to be possible to turn off buffering on sp
> -Original Message-
> From: Beginner [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, October 02, 2007 10:39 AM
> To: perl beginners
> Subject: Re: Variable scope
>
> On 2 Oct 2007 at 15:23, Rob Dixon wrote:
>
> > >
> > > $| = 1;
>
> I
On 2 Oct 2007 at 15:23, Rob Dixon wrote:
> Hi Dermot. You're a little confused, but you're not far out!
Your being kind.
> >
> > $| = 1;
I wasn't aware this only applied to STDOUT. My log messages all
appear at once, when the script has exited and I was hoping for some
'realtime' messages.
On 10/2/07, Beginner <[EMAIL PROTECTED]> wrote:
> Ideally I want to create the log file outside any sub routines so
> that $log to be available to any sub I have created and hence not
> scoped to any one sub routine.
In other words, $log needs to be a global variable, so that it's
available every
Beginner wrote:
I thought that the code snip below should work but I am not getting
my text into the the file. The file is created but it's empty.
Ideally I want to create the log file outside any sub routines so
that $log to be available to any sub I have created and hence not
scoped to an
Hi,
I thought that the code snip below should work but I am not getting
my text into the the file. The file is created but it's empty.
Ideally I want to create the log file outside any sub routines so
that $log to be available to any sub I have created and hence not
scoped to any one sub routi
On Mon, Oct 02, 2006 at 07:15:38AM -0700, Derek B. Smith wrote:
>
> For a complete understanding of scope (not listerine)
> : )
> please read the following:
> http://perl.plover.com/local.html#2_Localized_Filehandles
>
> and
> http://www.perlmonks.org/?node_id=564448
&
> undefined
> value.
>
> You can see this in the following script.
>
> use strict;
> use warnings;
> use Data::Dumper 'Dumper';
>
> my $service;
>
> ($service) = ();
>
> print Dumper $service;
>
John,
For a complete un
John Ackley wrote:
: while( ($service) = $SERVICE->fetchrow_array ) {
According to the DBI docs:
"If there are no more rows or if an error occurs,
then fetchrow_array returns an empty list."
When a value is returned, $service is set to that value.
When we get to the end of the l
simple scope question
when is a global not a global?
or how to get a value from inside a while() to the outside?
two tests-extracted from much large program to show my problem
test 1
my $count;
my $service;
while( ($service) = $SERVICE
quot; and pass that variable to any
> subroutines that needed it with @_.
>
> Or you could declare that variable with "local" or some other "scope
> defining declaration" so that it would be available automatically in any
> and all subroutines called from
u could declare that variable with "local" or some other "scope
defining declaration" so that it would be available automatically in any
and all subroutines called from the level you declared the var as "local"
My question concerns a little of form and a little of f
On Thursday 20 April 2006 21:48, Tom Phoenix wrote:
> On 4/20/06, Allister <[EMAIL PROTECTED]> wrote:
> > %qnums_quests = ($quest_number, $quest_string);
>
> The assignment operator replaces the entire variable on the left with
> the value on the right. If you wish to modify the hash, instead of
>
On 4/20/06, Allister <[EMAIL PROTECTED]> wrote:
> %qnums_quests = ($quest_number, $quest_string);
The assignment operator replaces the entire variable on the left with
the value on the right. If you wish to modify the hash, instead of
replacing everything it contains, you probably want a stateme
be something to do with the
way that I am assigning the key/value pairs to the hash, and possibly due to
scope as well, but am unable to find out what I am doing wrong. Perhaps some
kind person on the list could assist me. Excuse my code which is probably
execrable. Thanks for any help
[EMAIL PROTECTED] wrote:
...
My question is how to access $dbaccess variable (object) defined and
initialized in test.pm within test2.pm module?
If $dbaccess is delared with 'my' in test.pm, you cannot directly access
it from another file. You have two basic options:
1. Provide an accessor
*dbaccess = \$test::dbaccess;
print $dbaccess; #the same as 'print $test::dbaccess;'
-Original Message-
>From: [EMAIL PROTECTED]
>Sent: Feb 2, 2006 11:50 AM
>To: beginners@perl.org
>Subject: scope of the variable?
>
>Hello All,
>I have following question re
Hello All,
I have following question regarding accessing variable from other module:
In test.pm I have following:
#BEGIN OF THE TEST.PM
package test;
use strict;
use warnings;
#
# The object responsible for managing the database connections.
#
my $dbaccess = undef;
-somewhere else
$dbaccess =
Jeff Pang wrote:
I think the only difference between the two is Stat's code do the things of
sharing vars across modules really.
Under mod_perl,the situation is very different from common CGI environment,and
the vars sharing sometimes is useful and needed.
I hope I'm correct.If not,the criticis
re welcome.
-Original Message-
>From: John Doe <[EMAIL PROTECTED]>
>Sent: Jan 16, 2006 4:09 AM
>To: beginners@perl.org
>Subject: Re: about the var's scope
>
>Shawn Corey am Montag, 16. Januar 2006 04.12:
>[...]
>> > Ok, it would be interesting to look d
Shawn Corey am Montag, 16. Januar 2006 04.12:
[...]
> > Ok, it would be interesting to look deeper into the mess of different
> > variables all named with the same name $q, exported across the modules,
> > overwritten by several imports...
> >
> > What do you want to achieve with your code? It look
That's a good end for us all.Thanks for Shawn and John too.
-Original Message-
>From: John Doe <[EMAIL PROTECTED]>
>Sent: Jan 16, 2006 2:09 PM
>To: beginners@perl.org
>Subject: Re: about the var's scope
>
>Shawn Corey am Montag, 16. Januar 2006 04.12:
>
Shawn Corey am Montag, 16. Januar 2006 04.12:
> John Doe wrote:
> > [reordered to bottom style posting]
> >
> > Jeff Pang am Montag, 16. Januar 2006 01.59:
> >>Thanks for Shawn.The main script can see the global var $q coming from
> >>module,since the main script import this symbol via 'use My::HTM
John Doe wrote:
[reordered to bottom style posting]
Jeff Pang am Montag, 16. Januar 2006 01.59:
Thanks for Shawn.The main script can see the global var $q coming from
module,since the main script import this symbol via 'use My::HTML
qw($q)'.But the modules have no any importing behavior,why the
n Doe <[EMAIL PROTECTED]>
>Sent: Jan 16, 2006 9:48 AM
>To: beginners@perl.org
>Subject: Re: about the var's scope
>
>[reordered to bottom style posting]
>> -Original Message-
>>
>> >From: Shawn Corey <[EMAIL PROTECTED]>
>> >Sent: Jan 15
[reordered to bottom style posting]
> -Original Message-
>
> >From: Shawn Corey <[EMAIL PROTECTED]>
> >Sent: Jan 15, 2006 10:58 PM
> >To: beginners@perl.org
> >Subject: Re: about the var's scope
> >
> >Jeff Pang wrote:
> >> Hell
-Original Message-
>From: Shawn Corey <[EMAIL PROTECTED]>
>Sent: Jan 15, 2006 10:58 PM
>To: beginners@perl.org
>Subject: Re: about the var's scope
>
>Jeff Pang wrote:
>> Hello,lists,
>>
>> Seeing these code below please.I can't know
Jeff Pang wrote:
Hello,lists,
Seeing these code below please.I can't know why the var defined in the main
script can been accessed in the modules that used by the main script?thanks.
From `perldoc vars`:
While the vars pragma cannot duplicate the effect of package lexicals
(total transparen
Hello,lists,
Seeing these code below please.I can't know why the var defined in the main
script can been accessed in the modules that used by the main script?thanks.
script.pl:
use vars qw($q);
use CGI;
use lib qw(.);
use My::HTML qw($q); # My/HTML.pm is in the same
Dr.Ruud wrote:
> Wiggins d'Anconia:
>
>
>>the memory will still be available to the same process,
>>so it will not be available to other programs for instance until the
>>program has ended.
>
>
> And even that is not entirely true, because the memory manager of your
> OS can decide to swap stal
Wiggins d'Anconia:
> the memory will still be available to the same process,
> so it will not be available to other programs for instance until the
> program has ended.
And even that is not entirely true, because the memory manager of your
OS can decide to swap stale stuff from precious RAM to di
Wiggins d'Anconia wrote:
JupiterHost.Net wrote:
I just had a discussion about variables going out of scope (for memory
considerations)
The idea was presented that variables go out of scope as soon they're
last referenced in a block, I always thought it was when the block ended.
actual project is one thing, I'm really mostly
curious if that is true or not, that its out of scope when its last
referenced in a block instead of the end of a block.
In a language like Perl, it can be pretty hard to determine when a
variable is last referenced. Here's a simple exam
gt;>
> >
> >} # memory for $foo has been released
>
> Good idea Shawn :) the actual project is one thing, I'm really mostly
> curious if that is true or not, that its out of scope when its last
> referenced in a block instead of the end of a block.
In a langu
JupiterHost.Net wrote:
Good idea Shawn :) the actual project is one thing, I'm really mostly
curious if that is true or not, that its out of scope when its last
referenced in a block instead of the end of a block.
I still think at the end of the block. Going out-of-scope when last
JupiterHost.Net wrote:
> I just had a discussion about variables going out of scope (for memory
> considerations)
>
> The idea was presented that variables go out of scope as soon they're
> last referenced in a block, I always thought it was when the block ended.
>
When
statement.
{
{
my $foo = load_100M_of_data();
print $foo; # $foo is using 100M of memeory ±
} # memory for $foo has been released
Good idea Shawn :) the actual project is one thing, I'm really mostly
curious if that is true or not, that its out of scope when its last
refere
my $foo = load_100M_of_data();
print $foo; # $foo is using 100M of memeory ±
} # memory for $foo has been released
# A) $foo is now out of scope (and therefore no longer 100M of
memory) since its not used anywhere after that print() in this block
# 100 lines of code without any u
1 - 100 of 206 matches
Mail list logo