Eric wrote:
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
On Feb 6, 11:01 pm, jeffp...@netzero.net (Jeff Peng) wrote:
> 在 2010-02-05五的 06:27 -0800,Eric写道:
>
> > 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
在 2010-02-05五的 06:27 -0800,Eric写道:
> 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 h
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:: scope as loc
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
On 10/22/07, Siva Prasad <[EMAIL PROTECTED]> wrote something resembling:
> sub GET_Values
> {
> my $Rows;
> my $cate;
What are those variables used for?
> my $self=shift;
> print "$self->{InputFile}\n";
> (open my $FILE_H '<', $self->{InputFile}) || die"cannot open the input
> file";
> while(<$F
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 Wed, May 03, 2006 at 09:17:21AM -0500, Rance Hall wrote:
> Assuming you had a script configuration variable that was used numerous
> places in your script, further assume that you have "use strict;" in
> your perl script.
>
> You could declare the variable "my" and pass that variable to any
Assuming you had a script configuration variable that was used numerous
places in your script, further assume that you have "use strict;" in
your perl script.
You could declare the variable "my" and pass that variable to any
subroutines that needed it with @_.
Or you could declare that varia
> -Original Message-
> From: Jenda Krynicky [mailto:[EMAIL PROTECTED]
> Sent: Monday, October 11, 2004 10:39 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Variable scope in wanted function
>
>
> From: Gunnar Hjalmarsson <[EMAIL PROTECTED]>
> > Ron
Ron Goral wrote:
Gunnar Hjalmarsson wrote:
One possible solution is to move the ProcessFile() function out
from FindPath(), so the former is no longer a nested sub:
sub ProcessFile {
my ($a_files, $file_name) = @_;
push @$a_files, $File::Find::name if $_ eq $file_name;
}
and
> -Original Message-
> From: Gunnar Hjalmarsson [mailto:[EMAIL PROTECTED]
> Sent: Sunday, October 10, 2004 6:32 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Variable scope in wanted function
>
>
> Ron Goral wrote:
> > I am having some difficulty with a m
From: Gunnar Hjalmarsson <[EMAIL PROTECTED]>
> Ron Goral wrote:
> > I am having some difficulty with a module that is using File::Find.
> > The method is below.
> >
> > The idea is to enter this method feeding it a file name and
> > beginning directory and then looking for all occasions of
> > $fi
Ron Goral wrote:
I am having some difficulty with a module that is using File::Find.
The method is below.
The idea is to enter this method feeding it a file name and
beginning directory and then looking for all occasions of
$file_name and push those addresses into @a_files. This works fine
until I
Greetings All -
I am having some difficulty with a module that is using File::Find. The
method is below.
The idea is to enter this method feeding it a file name and beginning
directory and then looking for all occasions of $file_name and push those
addresses into @a_files. This works fine until
William Martell <[EMAIL PROTECTED]> wrote:
:
: Hi Charles. Thank you very much for the code and the lesson.
: Works perfectly!
It wasn't meant to be a finished product. Just an example to
learn from. You need to, at least, add some error checking, but
I am glad it works. :)
: I am trying t
Hi Charles. Thank you very much for the code and the lesson. Works
perfectly! I am trying to add the address portion to this but I am still
having some trouble. I wanted to see if I could ask you questions regarding
your code for even more insight. Thanks in advance for your time and
consider
William Martell <[EMAIL PROTECTED]> wrote:
NOTE: This response is long. If you want to ask a question
be responsible and delete anything that is not
relevant to your question. Do NOT top post and repeat
the entire messa
099","location: Casa View ","paper: The Dallas
Morning News","date: 04/04/2004",
[/RESULT]
My desired result is this, (I want to be able to import this data into
excel)
[DESIRED]
price: beds: bath: phone: address: location: paper: date:
data, data, data, data, d
William Martell <[EMAIL PROTECTED]> wrote:
:
: I am trying to get this code to write the variables in
: a specific order, even if they are undefined or blank.
: I would like each row seperated by newline.
What is a row? What specific order?
: I am running into a problem with the scope of the
n - indicates you are sorting on the field [ that comes after ] 'n' th "," -- sorry
for typo.
-Original Message-
From: Jayakumar Rajagopal
Sent: Thursday, April 08, 2004 2:31 PM
To: William Martell; [EMAIL PROTECTED]
Subject: RE: Help
u are sorrting on the field 'n' th "," .
thanks,
Jay
-Original Message-
From: William Martell [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 08, 2004 1:15 PM
To: [EMAIL PROTECTED]
Subject: Help with Variable Scope, Regular Expressions
Hello All.
Thank you for rea
Hello All.
Thank you for reading my email :)
I am trying to get this code to write the variables in a specific order,
even if they are undefined or blank. I would like each row seperated by
newline. I am running into a problem with the scope of the variable being
limited to the block of code it
on Thu, 20 Jun 2002 12:41:34 GMT, Martin A. Hansen wrote:
> i will elaborate the question:
>
>
> i have a huge script with many global variables and subroutines.
>
> several variable names are reused, but lexically scoped to
> subroutines and everything works fine.
>
> but if you forget (bug
At 02:41 PM 6/20/02 +0200, Martin A. Hansen wrote:
>i will elaborate the question:
>
>
>i have a huge script with many global variables and subroutines.
>
>several variable names are reused, but lexically scoped to subroutines
>and everything works fine.
>
>but if you forget (bugs do occur!) to d
On Fri, 10 Aug 2001, Birgit Kellner wrote:
> If I have one script that requires another and I want to make the former's
> global variables available in the latter, and have use strict NOT complain,
> what should I do? Perhaps I should not use "require", but "use"?
IMHO, the proper way to do this
I am using a script to manage flatfile databases which consists of several
perl files: a central perl script contains all subroutines for data
manipulation, another script prints out html code, and a configuration file
sets all global variables like for instance $db_script_path for the
directo
er $test/;
and then define them later.
-Original Message-
From: perl newbie [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 20, 2001 3:25 PM
To: [EMAIL PROTECTED]
Subject: Re: Variable scope and definition
I am trying to understand the correct way to define
variables and their scope.
Here
On Jul 20, perl newbie said:
>I am trying to understand the correct way to define
>variables and their scope.
>
>Here are two simple PERL ( test1.pl and test2.pl
>)scripts. test1.pl work fine, while test2.pl does not.
>
>Would appreciate any help in understanding why
>test2.pl is complaining abo
I am trying to understand the correct way to define
variables and their scope.
Here are two simple PERL ( test1.pl and test2.pl
)scripts. test1.pl work fine, while test2.pl does not.
Would appreciate any help in understanding why
test2.pl is complaining about "Global symbols"
Thanks
PN
test
On Jul 3, Michael Dube said:
>I tried scoping the variable to the parent by calling it
>parent::$log->write... no luck.
> parent::$log->write("Got Here");
Variables are made up of a sigil ($, @, %, &, *), an optional namespace
(CGI::, main::, :: (which is main::)), and the symbol name (foo
Ok... can someone give me a clue about the issue of variable scoping? I
have a program that uses a logging module (Log::LogLite), and so I have an
object $log that has a ->write method. I have a few custom packages that I
wrote that I want to be able to also write to the logfile. What is the
syn
> I think I see where Geraint is coming from, but a my'd
> variable is the only type of variable that is NOT a "global",
> using the term as it is used in "official" perl documentation.
Must have missed that part - you learn something new every minute with this
list ; )
> > I could not get the following sub to work until
> > I had to move $emailLog inside the sub to get this
> > to work on the server.
> >
> > What did I miss or not understand?
More on that in a moment. First...
> Try putting a "my" (without quotes) before the variable.
> What that will do
On Tue, Jun 26, 2001 at 10:08:35AM -0700, Gregg Williams wrote:
> When "use strict 'vars'" is in effect and you are using a global variable
> (such as $emailLog), Perl will issue a warning alerting you to that
> fact--for example:
>
> Global symbol "$emailLog" requires explicit package name at
so has the effect of documenting your intent to use a global variable
to anyone who reads the code.
If you have multiple variables you want to declare, separate them by spaces:
use vars qw($myScalar @myArray %myHash)
--greggw
> -Original Message-----
> From: Maxim Berlin [mailto:[EMA
Hello David,
Tuesday, June 26, 2001, David Gilden <[EMAIL PROTECTED]> wrote:
DG> Quick question,
DG> I could not get the following sub to work until
DG> I had to move $emailLog inside the sub to get this
DG> to work on the server.
DG> What did I miss or not understand?
i suggest you always
Try putting a "my" (without quotes) before the variable. What that will do is
to make it global so any function as well as the main part of your code will
be able to access it (then you won't need to put it within sub addEmail).
Sometimes though, you want only the function to be able to access a
Quick question,
I could not get the following sub to work until
I had to move $emailLog inside the sub to get this
to work on the server.
What did I miss or not understand?
Thanks
Dave
## not seen by the sub,
$emailLog = 'logs/email_log';
# Send E-Mail
&send_mail;
# Append email lo
At 01:08 PM 6/7/01 -0400, Robin Lavallee (LMC) wrote:
> I have a small conceptual problem. I have been
>told that doing:
>
>my $item;
>foreach $item (@arr) { ... }
>
>is more efficient than:
>foreach my $item (@arr) { ... }
Even if it is, this is the wrong thing to optimize for. If you'r
On Jun 7, Paul said:
>--- "Robin Lavallee (LMC)" <[EMAIL PROTECTED]> wrote:
>> Then can someone explains why the following code:
>>
>> #---Begin Code---
>> use strict;
>> my $par="50";
>> print "$par\n";
>>
>> my @arr = ('first', 'second', 'third');
>> foreach $par (@arr)
>> {
>> print "$p
--- "Robin Lavallee (LMC)" <[EMAIL PROTECTED]> wrote:
> Then can someone explains why the following code:
>
> #---Begin Code---
> use strict;
> my $par="50";
> print "$par\n";
>
> my @arr = ('first', 'second', 'third');
> foreach $par (@arr)
> {
> print "$par\n";
> }
> print "$par\n";
> #
--- "Robin Lavallee (LMC)" <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I have a small conceptual problem. I have been
> told that doing:
>
> my $item;
> foreach $item (@arr) { ... }
>
> is more efficient than:
> foreach my $item (@arr) { ... }
>
> Because it does not reallocate memory each
Hi,
I have a small conceptual problem. I have been
told that doing:
my $item;
foreach $item (@arr) { ... }
is more efficient than:
foreach my $item (@arr) { ... }
Because it does not reallocate memory each time.
This means that the scope of $item in the second
example is actually a
53 matches
Mail list logo