develooper Front page | perl.beginners | Postings from April 2002

Re: wipe out elements in an array

Thread Previous | Thread Next
April 29, 2002 22:06
Re: wipe out elements in an array
Message ID:

On Monday, April 29, 2002, at 01:52 , Bryan R Harris wrote:

> Out of curiosity, do the $, $/ $\ variables maintain their values between
> runs?  Or are they reset before running a new script?

the short answer is that 'All Perl Special Variables are set to
the default upon invocation' - hence if you want to change them
from their defaults - you need to code that solution. Assuming
of course that I understood this as a simple question. else...

let me see if I get this,

I have scriptA and scriptB

and run

	mycmdPrompt:] ./scriptA

	mycmdPrompt:] ./scriptB

do the commands influence each other in how the various special variables
used internally by perl are set?

unless scriptA actually rebuilds and re-installs perl -

{ Or edits scriptB - or some common Perl Module - or system service
you have to be careful - there is some wanker who will show that
they can write a piece of perl that will load some new kernel module
that will do some majik voodoo.... ;-) When you start writing code
that generates other code that changes such things for you, clearly
you do not need to be asking about that here... }

then how it did

	$/ = "thingie";

in scriptA will have nothing to do with scriptB.

A way to think about 'scripting' is that it is the list of
sequential things that one wants done - so that you do not
have to sit there typing each of them in by hand.

Each of the scripts runs in its own memory space - and
will be replicatable -

{ as a general rule of thumb - scripts that return random
events are considered to have at least one BUG in them - or
their author should not have been drinking like that while typing... }

as long as you do not change the text of the script - then
you will get what you typed.



Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About