[29790] in Perl-Users-Digest
Perl-Users Digest, Issue: 1033 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 14 18:16:24 2007
Date: Wed, 14 Nov 2007 15:09:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 14 Nov 2007 Volume: 11 Number: 1033
Today's topics:
Back references <leonard_plummer@hotmail.co.uk>
Back references <leonard_plummer@hotmail.co.uk>
Re: Back references <pgp@see.sig.invalid>
Re: Back references <jimsgibson@gmail.com>
Re: Back references <leonard_plummer@hotmail.co.uk>
Re: Back references <leonard_plummer@hotmail.co.uk>
Re: Back references <uri@stemsystems.com>
Re: Back references <uri@stemsystems.com>
Binary to Decimal for >2**32 <usenet05@drabble.me.uk>
Re: Binary to Decimal for >2**32 <jurgenex@hotmail.com>
Re: Command Line Arguments from a File <g4173c@motorola.com>
Re: Command Line Arguments from a File <jimsgibson@gmail.com>
Re: Distributed RVS, Darcs, tech love <jo@durchholz.org>
Fender Guitars arturklis2@gmail.com
Re: how to check whether the field is filled or empty i <jimsgibson@gmail.com>
Re: MySQL & Perl: Using a Dynamic SELECT Statement <jwcarlton@gmail.com>
Re: Trap memory overflow xhoster@gmail.com
Ultimate Guitars!!!!! nutsbreaker@googlemail.com
Use of uninitialized value in concatenation <gil.kovary@gmail.com>
Re: Use of uninitialized value in concatenation <krahnj@telus.net>
Re: Use of uninitialized value in concatenation <smallpond@juno.com>
Re: Use of uninitialized value in concatenation <noreply@gunnar.cc>
Re: Use of uninitialized value in concatenation <placebo@petergreen.id.au>
Re: Use of uninitialized value in concatenation <krahnj@telus.net>
Re: Use of uninitialized value in concatenation <krahnj@telus.net>
Re: Using fork() sheinrich@my-deja.com
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 14 Nov 2007 11:21:37 -0800
From: Frieza <leonard_plummer@hotmail.co.uk>
Subject: Back references
Message-Id: <1195068097.016355.192120@v3g2000hsg.googlegroups.com>
Hi I am studying Perl on my ciw course, I was wondering if anyone
could
tell me what back references are in regular expressions in plain
simple english, cause my course notes that I I need a dictionary
everytime I read a sentence
------------------------------
Date: Wed, 14 Nov 2007 11:22:29 -0800
From: Frieza <leonard_plummer@hotmail.co.uk>
Subject: Back references
Message-Id: <1195068149.863306.167090@19g2000hsx.googlegroups.com>
Hi I am studying Perl on my ciw course, I was wondering if anyone
could
tell me what back references are in regular expressions in plain
simple english, cause my course notes that I have, I need a dictionary
everytime I read a sentence.
Thanks
------------------------------
Date: Wed, 14 Nov 2007 19:50:46 +0000
From: Philip Potter <pgp@see.sig.invalid>
Subject: Re: Back references
Message-Id: <fhfjim$gfs$1@aioe.org>
Frieza wrote:
> Hi I am studying Perl on my ciw course, I was wondering if anyone
> could
> tell me what back references are in regular expressions in plain
> simple english, cause my course notes that I have, I need a dictionary
> everytime I read a sentence.
Get a copy of "Programming Perl" or "Learning Perl", both by Larry Wall
et al. They're very good textbooks absolutely stuffed with plain simple
english.
Backreferences are the $1..$9 variables defined after a regular
expression has been applied to a string. They contain the substrings
which match the bits in parentheses. For example:
#!/usr/bin/perl
use strict;
my $string = "aaa bbb";
$string =~ /(a*) (b*)/;
print "\$1 = '$1' and \$2 = '$2'\n";
Phil
--
Philip Potter pgp <at> doc.ic.ac.uk
------------------------------
Date: Wed, 14 Nov 2007 11:56:49 -0800
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: Back references
Message-Id: <141120071156494732%jimsgibson@gmail.com>
In article <1195068149.863306.167090@19g2000hsx.googlegroups.com>,
Frieza <leonard_plummer@hotmail.co.uk> wrote:
> Hi I am studying Perl on my ciw course, I was wondering if anyone
> could
> tell me what back references are in regular expressions in plain
> simple english, cause my course notes that I have, I need a dictionary
> everytime I read a sentence.
> Thanks
A back reference in a regular expression is a value that has been
matched and captured earlier ("back") in the pattern. Perl back
references are denoted by \1, \2, etc.
For example, if you wish to match any two consecutive and identical
lower-case letters, you can use the regular expression:
m/([a-z])\1/
Note how this will differ from the regular expression
m/[a-z][a-z]/
which will match any two consecutive lower-case letters not necessarily
the same.
See also
perldoc perlretut
perldoc perlre
and search for 'backreference'.
--
Jim Gibson
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
------------------------------
Date: Wed, 14 Nov 2007 11:58:00 -0800
From: Frieza <leonard_plummer@hotmail.co.uk>
Subject: Re: Back references
Message-Id: <1195070280.524643.13900@o80g2000hse.googlegroups.com>
On 14 Nov, 19:50, Philip Potter <p...@see.sig.invalid> wrote:
> Frieza wrote:
> > Hi I am studying Perl on my ciw course, I was wondering if anyone
> > could
> > tell me what back references are in regular expressions in plain
> > simple english, cause my course notes that I have, I need a dictionary
> > everytime I read a sentence.
>
> Get a copy of "Programming Perl" or "Learning Perl", both by Larry Wall
> et al. They're very good textbooks absolutely stuffed with plain simple
> english.
>
> Backreferences are the $1..$9 variables defined after a regular
> expression has been applied to a string. They contain the substrings
> which match the bits in parentheses. For example:
>
> #!/usr/bin/perl
> use strict;
>
> my $string = "aaa bbb";
> $string =~ /(a*) (b*)/;
> print "\$1 = '$1' and \$2 = '$2'\n";
>
> Phil
>
> --
> Philip Potter pgp <at> doc.ic.ac.uk
Thanks Phil that makes it alot clearer already, I will definetly look
up those books by Larry Wall.
Thanks
------------------------------
Date: Wed, 14 Nov 2007 12:09:29 -0800
From: Frieza <leonard_plummer@hotmail.co.uk>
Subject: Re: Back references
Message-Id: <1195070969.468089.320320@k79g2000hse.googlegroups.com>
On 14 Nov, 19:56, Jim Gibson <jimsgib...@gmail.com> wrote:
> In article <1195068149.863306.167...@19g2000hsx.googlegroups.com>,
>
> Frieza <leonard_plum...@hotmail.co.uk> wrote:
> > Hi I am studying Perl on my ciw course, I was wondering if anyone
> > could
> > tell me what back references are in regular expressions in plain
> > simple english, cause my course notes that I have, I need a dictionary
> > everytime I read a sentence.
> > Thanks
>
> A back reference in a regular expression is a value that has been
> matched and captured earlier ("back") in the pattern. Perl back
> references are denoted by \1, \2, etc.
>
> For example, if you wish to match any two consecutive and identical
> lower-case letters, you can use the regular expression:
>
> m/([a-z])\1/
>
> Note how this will differ from the regular expression
>
> m/[a-z][a-z]/
>
> which will match any two consecutive lower-case letters not necessarily
> the same.
>
> See also
>
> perldoc perlretut
> perldoc perlre
>
> and search for 'backreference'.
>
> --
> Jim Gibson
>
> Posted Via Usenet.com Premium Usenet Newsgroup Services
> ----------------------------------------------------------
> ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
> ----------------------------------------------------------
> http://www.usenet.com
Jim thanks very much the added detail has helped alot.
Thanks again
------------------------------
Date: Wed, 14 Nov 2007 21:09:57 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Back references
Message-Id: <x7sl384jq2.fsf@mail.sysarch.com>
>>>>> "PP" == Philip Potter <pgp@see.sig.invalid> writes:
PP> Frieza wrote:
>> Hi I am studying Perl on my ciw course, I was wondering if anyone
>> could
>> tell me what back references are in regular expressions in plain
>> simple english, cause my course notes that I have, I need a dictionary
>> everytime I read a sentence.
PP> Get a copy of "Programming Perl" or "Learning Perl", both by Larry Wall
PP> et al. They're very good textbooks absolutely stuffed with plain simple
PP> english.
PP> Backreferences are the $1..$9 variables defined after a regular
PP> expression has been applied to a string. They contain the substrings
PP> which match the bits in parentheses. For example:
that is incorrect. those are grabs and the scalar variables used to
access them later on (in the replacement string or later).
backreferences are when you refer to a previous grab INSIDE the same
regex. $1 inside a regex will refer to a grab from an earler regex grab,
not the current one. you use \1 to refer to the first grab in the
current regex.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Wed, 14 Nov 2007 21:10:25 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Back references
Message-Id: <x7oddw4jpa.fsf@mail.sysarch.com>
>>>>> "F" == Frieza <leonard_plummer@hotmail.co.uk> writes:
F> Thanks Phil that makes it alot clearer already, I will definetly look
F> up those books by Larry Wall.
and he was wrong. see my other post in this thread.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Wed, 14 Nov 2007 21:45:57 +0100
From: Graham Drabble <usenet05@drabble.me.uk>
Subject: Binary to Decimal for >2**32
Message-Id: <Xns99E8DD6A8F6B4grahamdrabblelineone@ID-77355.user.dfncis.de>
Hi all,
I have been using a binary to decimal converter for number <2**16 for
a while now using
$bin = sprintf("%016b",$dec)
which works fine.
I've now had to try and do the same conversion for numbers up to 2**
48 and have discovered that this does not work for numbers >=2**32
(everything >=2**32 returns the same as (2**32)-1 ).
I'm currently getting round this with
use strict;
use warnings;
use Math::BigInt;
my $num = new Math::BigInt 2**47 + 2**31 + 2**30;
if ($num >= 2**32){
my $upper = int($num / (2**32));
my $lower = $num % 2**32;
$upper = sprintf ("%016b",$upper);
$lower = sprintf ("%032b",$lower);
print "$upper$lower\n";
}
else
{
printf ("%048b\n",$num);
}
Which works but seems very inelegant. Does anyone have a better
suggestion?
Also hex() returns a warning when given a hex string >2**32 but
returns the correct result. Is this something that can be relied on
or do I need to find a work around for that as well?
--
Graham Drabble
http://www.drabble.me.uk/
------------------------------
Date: Wed, 14 Nov 2007 22:06:43 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Binary to Decimal for >2**32
Message-Id: <TjK_i.7038$cD.3984@trndny08>
Graham Drabble wrote:
> I have been using a binary to decimal converter for number <2**16 for
> a while now [...] which works fine.
> I've now had to try and do the same conversion for numbers up to 2**
> 48 and have discovered that this does not work for numbers >=2**32
> use Math::BigInt;
[...]
> Which works but seems very inelegant. Does anyone have a better
> suggestion?
Use a perl that is compiled with 64-bit support on a 64-bit machine.
jue
------------------------------
Date: Wed, 14 Nov 2007 10:45:55 -0800
From: T <g4173c@motorola.com>
Subject: Re: Command Line Arguments from a File
Message-Id: <1195065955.596294.100710@22g2000hsm.googlegroups.com>
On Nov 14, 9:40 am, Ben Morrow <b...@morrow.me.uk> wrote:
> You are supposed to post an example we can actually run.
Fair enough, I was trying to be brief, however maybe I was too brief.
Below is sample code. In the file I have:
#
# Default Command Line switches.
#
-noclearcase
-email mail
When I run the script below I get:
$ test.pl
-noclearcase -email mail
Unknown option: email mail
Died at test.pl line 10.
Looks like it's stripping off the "-" on email. If I run with command
line
options also I get:
$ test.pl -minor
-minor
No "-minor" build file?
Which isn't getting any of the command line arguments?
I know I must be doing something wrong, so any help in this is greatly
appreciated!
Thanks
Tom
Test Code Below:
#!/usr/local/bin/perl
#
#
use Getopt::Long qw(GetOptionsFromArray);
#
# Get the command line options.
#
sub Command_Line {
print "@_\n";
GetOptionsFromArray(\@_,
"major:s" => \$major,
"minor:s" => \$minor,
"qsfonly" => \$qsfonly,
"noqsf" => \$noqsf,
"noclearcase" => \$noclearcase,
"full" => \$full,
"email=s" => \$email,
"classic" => \$classic,
"version" => \$version,
"help" => \$help ) || die;
}
Command_Line(@ARGV);
#
# See if they want to use a different Control File other than the
default ALTERA file.
#
if (! @ARGV) {
$Control_File = "ALTERA";
} else {
$Control_File = "$ARGV[0]";
}
#
# Find the Altera Build file and get the variables, if not error out.
#
if ( -e "$Control_File" ) {
#
# Open Altera build file for reading and get the variables.
#
open (ALTERA, "$Control_File") || die "Can't Open File
\"$Control_File\": $!\n";
while (<ALTERA>) {
# Ingore lines that start with # or are just spaces...
if ((!/^#/) && (/\S/)){
chomp;
s/=/ /;
@x = $_;
@x = split;
if (/DESIGN/) {
$design = $x[1];
}
elsif (/REVFILE/) {
$revfilename = $x[1];
}
elsif (/MAJOR/) {
$majorrev = $x[1];
}
elsif (/MINOR/) {
$minorrev = $x[1];
}
elsif (/\.tcl$/) {
push(@qsfbld, $x[0]);
}
elsif (/^-\w+/) {
push(@CMDLINE,"$_");
}
}
}
close (ALTERA);
}
else {
print "No \"$Control_File\" build file?\n";
exit (1);
}
Command_Line(@CMDLINE);
print "@ARGV\n";
print "Major $major\n";
print "Minor $minor\n";
print "QSFOnly $qsfonly\n";
print "NoQSF $noqsf\n";
print "No Clearcase $noclearcase\n";
print "Full $full\n";
print "Email $email\n";
print "Classic $classic\n";
print "Version $version\n";
print "Help $help\n";
------------------------------
Date: Wed, 14 Nov 2007 11:48:23 -0800
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: Command Line Arguments from a File
Message-Id: <141120071148234360%jimsgibson@gmail.com>
In article <1195065955.596294.100710@22g2000hsm.googlegroups.com>,
<g4173c@motorola.com> wrote:
> On Nov 14, 9:40 am, Ben Morrow <b...@morrow.me.uk> wrote:
> > You are supposed to post an example we can actually run.
>
> Fair enough, I was trying to be brief, however maybe I was too brief.
> Below is sample code. In the file I have:
>
> #
> # Default Command Line switches.
> #
> -noclearcase
> -email mail
You can append file data to the end of your program after a '__DATA__'
token and use the special <DATA> file handle to read it. While this is
not something you want to do in your real program, it makes it easier
for people to help you.
See the posting guidelines for this group for ways to improve your
chances for getting useful help:
<http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html>
>
> When I run the script below I get:
>
> $ test.pl
>
> -noclearcase -email mail
> Unknown option: email mail
> Died at test.pl line 10.
You are passing the string "-email mail" as a single element of the
first-argument array to GetOptionsFromArray. Since this is not a valid
option, GetOptionsFromArray issues the above message (first stripping
the '-' which identifies an argument).
>
> Looks like it's stripping off the "-" on email. If I run with command
> line
> options also I get:
>
> $ test.pl -minor
> -minor
> No "-minor" build file?
While the function GetOptions will remove parsed options from the @ARGV
array, the function GetOptionsFromArray does not. Therefore, after
Command_Line has parsed @ARGV the first time, the element "-minor"
remains in $ARGV[0]. This then becomes the name of the control file
your program tests for existence. This test fails and you get the error
message as above.
Note other comments below.
> Test Code Below:
>
> #!/usr/local/bin/perl
You should have here:
use strict;
use warnings;
> #
> #
> use Getopt::Long qw(GetOptionsFromArray);
> #
> # Get the command line options.
> #
> sub Command_Line {
> print "@_\n";
> GetOptionsFromArray(\@_,
> "major:s" => \$major,
> "minor:s" => \$minor,
> "qsfonly" => \$qsfonly,
> "noqsf" => \$noqsf,
> "noclearcase" => \$noclearcase,
> "full" => \$full,
> "email=s" => \$email,
> "classic" => \$classic,
> "version" => \$version,
> "help" => \$help ) || die;
> }
> Command_Line(@ARGV);
>
> #
> # See if they want to use a different Control File other than the
> default ALTERA file.
> #
> if (! @ARGV) {
> $Control_File = "ALTERA";
> } else {
> $Control_File = "$ARGV[0]";
> }
> #
> # Find the Altera Build file and get the variables, if not error out.
> #
> if ( -e "$Control_File" ) {
> #
> # Open Altera build file for reading and get the variables.
> #
> open (ALTERA, "$Control_File") || die "Can't Open File
> \"$Control_File\": $!\n";
> while (<ALTERA>) {
> # Ingore lines that start with # or are just spaces...
> if ((!/^#/) && (/\S/)){
> chomp;
> s/=/ /;
> @x = $_;
The above line is totally unnecessary.
> @x = split;
> if (/DESIGN/) {
> $design = $x[1];
> }
> elsif (/REVFILE/) {
> $revfilename = $x[1];
> }
> elsif (/MAJOR/) {
> $majorrev = $x[1];
> }
> elsif (/MINOR/) {
> $minorrev = $x[1];
> }
> elsif (/\.tcl$/) {
> push(@qsfbld, $x[0]);
> }
> elsif (/^-\w+/) {
> push(@CMDLINE,"$_");
The above line should be:
push(@CMDLINE,@x);
> }
> }
> }
> close (ALTERA);
> }
> else {
> print "No \"$Control_File\" build file?\n";
> exit (1);
> }
> Command_Line(@CMDLINE);
> print "@ARGV\n";
> print "Major $major\n";
> print "Minor $minor\n";
> print "QSFOnly $qsfonly\n";
> print "NoQSF $noqsf\n";
> print "No Clearcase $noclearcase\n";
> print "Full $full\n";
> print "Email $email\n";
> print "Classic $classic\n";
> print "Version $version\n";
> print "Help $help\n";
--
Jim Gibson
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
------------------------------
Date: Wed, 14 Nov 2007 23:14:37 +0100
From: Joachim Durchholz <jo@durchholz.org>
Subject: Re: Distributed RVS, Darcs, tech love
Message-Id: <fhfrva$nmk$1@online.de>
Marc Espie schrieb:
> Apart from the fact that Knuth wrote a book series that is still THE
> definitive series on computer algorithms
I don't wish to diminish Knuth's work, but it's definitely not timeless.
For an alternative, see Sedgewick's "Algorithms in C/Pascal/whatever".
Not as rigorous about proving the properties of algorithms, but the
selection of algorithms is more modern, and the presentation is
palatable (instead of the assembly/flowchart mix that Knuth is so fond of).
There are other algorithm collections.
The largest one is the Internet itself. A search engine or Wikipedia
would be my first stop when looking for an algorithm.
(Agreeing with the rest.)
Regards,
Jo
------------------------------
Date: Wed, 14 Nov 2007 18:46:29 -0000
From: arturklis2@gmail.com
Subject: Fender Guitars
Message-Id: <1195065989.084416.209190@z24g2000prh.googlegroups.com>
Best off
http://fender-guitars-review.blogspot.com/
------------------------------
Date: Wed, 14 Nov 2007 09:12:47 -0800
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: how to check whether the field is filled or empty in perl TK
Message-Id: <141120070912471819%jimsgibson@gmail.com>
In article <1195050096.604403.314370@k35g2000prh.googlegroups.com>,
king <hara.acharya@gmail.com> wrote:
> I have a perl TK UI. Where the user will feed the Register value.
>
> ######################################################################
> our $t2=$left1->Label(-text=>'Register',-background=>'cyan')->pack();
>
> our $pre1=$left2->Label(-background=>'green', -width=>12,-
> borderwidth=>2, -relief=>'sunken')->Entry()-> pack();
> our $ent1=$left2->Entry(-background=>'green', -width=>12,-
> borderwidth=>2, -relief=>'sunken')->pack();
>
> $Register_1=$ent1->get();
> ####################################################################
>
> I want to check whether the user has feeded the register value or kept
> it null.
>
> so if i am doing a check like
>
> if (defined $Register_1) { do this}
> else { do this}
>
> but its not working. How can i check whether the user has given some
> value in the register block or not.
Check if length($Register_1) is equal to 0.
--
Jim Gibson
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
------------------------------
Date: Wed, 14 Nov 2007 15:08:09 -0800
From: Jason Carlton <jwcarlton@gmail.com>
Subject: Re: MySQL & Perl: Using a Dynamic SELECT Statement
Message-Id: <1195081689.454039.247260@57g2000hsv.googlegroups.com>
> > if ($check_username) {
> > if ($type eq "loose") {
> > $whereby1 = "WHERE username LIKE CONCAT('%',?,'%')";
> > }
> > else {
> > $whereby1 = "WHERE username=?";
> > }
> > my $sth = $dbh->prepare("SELECT id FROM posts " . $whereby1);
> > $sth->execute($search);
>
> You're using variables without showing us what they contain. What's
> in $search? The fact that you haven't shown it suggests you consider
> it irrlevant, but since you don't know what's going wrong, you
> shouldn't make that assumption.
In this case:
$check_username = true;
$type = "loose"; OR $type = "strict";
$search = "Jason";
All three are set dynamically, but for testing I included a print
statement that showed the values.
> > while (my ($this_id) = $sth->fetchrow_arrayref()) {
> > if (!(exists($topics{$this_id}))) { $topics{$this_id} = 1; }
> > }
> > }
> You've checked how? What debugging statement did you use? Did you
> print the value of $sth->{Statement} to see what SQL is actually being
> sent to the database handle?
I did not print $sth, good idea. For testing, though, I simply added a
"print" statement to the loop.
> This makes no sense. The SELECT statement is a string. Nothing
> more. It does not "allow" or prevent anything.
My thought exactly, which is why I'm rather confused. I thought that
perhaps I might be writing the SELECT statement incorrectly.
> > if ($check_username) {
> > if ($type eq "loose") {
> > my $sth = $dbh->prepare("SELECT id FROM posts WHERE username
> > LIKE CONCAT('%',?,'%')");
>
> You are declaring $sth here.
>
> > $sth->execute($search);
> > }
>
> And the block in which you declared it ends here. At this point, $sth
> ceases to exist.
>
> > else {
> > my $sth = $dbh->prepare("SELECT id FROM posts WHERE
> > username=?");
>
> Now you've declared a second $sth.
>
> > $sth->execute($search);
> > }
>
> And here the block in which you declared this second $sth ends. At
> this point, the second $sth also ceases to exist.
>
> > while (my ($this_id) = $sth->fetchrow_arrayref()) {
>
> Now you are attempting to use a variable that doesn't exist.
Gotcha. That makes sense, and really was not the preferred way,
anyway. I was assuming that fetchrow_arrayref() was going to grab the
$sth->execute outside of the block, but I see now that this was
incorrect.
> This tells me that you're not using strict. Why? It prevents you
> from making mistakes like this. It's also rude to ask us for help
> before you ask the computer for help.
Actually, I had used strict, but it gave me less information than when
I used CGI::Carp. All it said was "aborted due to compilation errors."
Thanks for the help,
Jason
------------------------------
Date: 14 Nov 2007 19:29:34 GMT
From: xhoster@gmail.com
Subject: Re: Trap memory overflow
Message-Id: <20071114142935.985$6G@newsreader.com>
"alexxx.magni@gmail.com" <alexxx.magni@gmail.com> wrote:
> I remember reading time ago that trapping memory overflow wasnt easy
> in Perl.
>
> Damn, now I have to allocate a lot of info in a 3dim structure:
>
> my @AAA; # 1st index: image index; 2nd: x coord; 3rd: y coord
> ...
> $AAA[$i][$x][$y]=....
> ...
>
> and it surely overflows since at some time the AAA structure does not
> contains my info anymore
Perl does not respond to OOM conditions by randomly deleting data.
Something else is going on.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
------------------------------
Date: Wed, 14 Nov 2007 09:16:45 -0800
From: nutsbreaker@googlemail.com
Subject: Ultimate Guitars!!!!!
Message-Id: <1195060605.452942.115460@i13g2000prf.googlegroups.com>
See all about it...
http://guitarspirit.blogspot.com/
------------------------------
Date: Wed, 14 Nov 2007 21:25:16 -0000
From: gil <gil.kovary@gmail.com>
Subject: Use of uninitialized value in concatenation
Message-Id: <1195075516.925803.65240@k79g2000hse.googlegroups.com>
when running Perl in "-w" mode, I get the following warning line:
"Use of uninitialized value in concatenation (.) or string at ./
check_log.pl line 177, <DAT> line 261."
when line 177 is:
"if ($$ref =~ /^\[(\d+?)\/(\d+?)\/(\d+?)\s+?(\d+?):(\d+?):(\d+?)$
\]/)"
if you do know what's the problem, I'll be glad to know, if not -
please don't get occupied by this issue.
------------------------------
Date: Wed, 14 Nov 2007 21:49:21 GMT
From: "John W. Krahn" <krahnj@telus.net>
Subject: Re: Use of uninitialized value in concatenation
Message-Id: <473B6D42.263EE04E@telus.net>
gil wrote:
>
> when running Perl in "-w" mode, I get the following warning line:
>
> "Use of uninitialized value in concatenation (.) or string at ./
> check_log.pl line 177, <DAT> line 261."
>
> when line 177 is:
>
> "if ($$ref =~ /^\[(\d+?)\/(\d+?)\/(\d+?)\s+?(\d+?):(\d+?):(\d+?)$
> \]/)"
You don't have a string with embedded variables or the concatenation
operator on that line so the warning must be generated by another line,
probably before this line. If you want more help show about 5-10 lines
before and after line 177.
John
--
use Perl;
program
fulfillment
------------------------------
Date: Wed, 14 Nov 2007 13:50:16 -0800
From: smallpond <smallpond@juno.com>
Subject: Re: Use of uninitialized value in concatenation
Message-Id: <1195077016.131134.220130@v2g2000hsf.googlegroups.com>
On Nov 14, 4:25 pm, gil <gil.kov...@gmail.com> wrote:
> when running Perl in "-w" mode, I get the following warning line:
>
> "Use of uninitialized value in concatenation (.) or string at ./
> check_log.pl line 177, <DAT> line 261."
>
> when line 177 is:
>
> "if ($$ref =~ /^\[(\d+?)\/(\d+?)\/(\d+?)\s+?(\d+?):(\d+?):(\d+?)$
> \]/)"
>
> if you do know what's the problem, I'll be glad to know, if not -
> please don't get occupied by this issue.
It wants to check for a time string of the form: "[dd/mm/yy hh:mm:ss]"
but $$ref has no value. I'm guessing DAT is an open file containing
about 260 lines of data.
--S
------------------------------
Date: Wed, 14 Nov 2007 23:17:08 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Use of uninitialized value in concatenation
Message-Id: <5q1afoFtni64U1@mid.individual.net>
gil wrote:
> if you do know what's the problem, I'll be glad to know, if not -
> please don't get occupied by this issue.
What kind of stupid remark is that??
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Wed, 14 Nov 2007 22:42:31 GMT
From: "Peter Wyzl" <placebo@petergreen.id.au>
Subject: Re: Use of uninitialized value in concatenation
Message-Id: <rRK_i.12613$CN4.9666@news-server.bigpond.net.au>
"gil" <gil.kovary@gmail.com> wrote in message
news:1195075516.925803.65240@k79g2000hse.googlegroups.com...
> when running Perl in "-w" mode, I get the following warning line:
>
> "Use of uninitialized value in concatenation (.) or string at ./
> check_log.pl line 177, <DAT> line 261."
>
> when line 177 is:
>
> "if ($$ref =~ /^\[(\d+?)\/(\d+?)\/(\d+?)\s+?(\d+?):(\d+?):(\d+?)$
> \]/)"
It would appear that at some point $$ref becomes a null value. In order to
avoid the warning you need to code in such a way that if you encounter $$ref
as a null, you do something other than bind it to the regex.
One simple way is
if ($$ref){
if ($$ref =~ /^\[(\d+?)\/(\d+?)\/(\d+?)\s+?(\d+?):(\d+?):(\d+?)$\]/){
#do whatever
}
}
So that effectively avoids the condition, but you also need to look at what
else is effected by that value potentially being a null, and handle those
error conditions too.
P
------------------------------
Date: Wed, 14 Nov 2007 22:58:37 GMT
From: "John W. Krahn" <krahnj@telus.net>
Subject: Re: Use of uninitialized value in concatenation
Message-Id: <473B7D7D.A0D19267@telus.net>
smallpond wrote:
>
> On Nov 14, 4:25 pm, gil <gil.kov...@gmail.com> wrote:
> > when running Perl in "-w" mode, I get the following warning line:
> >
> > "Use of uninitialized value in concatenation (.) or string at ./
> > check_log.pl line 177, <DAT> line 261."
> >
> > when line 177 is:
> >
> > "if ($$ref =~ /^\[(\d+?)\/(\d+?)\/(\d+?)\s+?(\d+?):(\d+?):(\d+?)$
> > \]/)"
> >
> > if you do know what's the problem, I'll be glad to know, if not -
> > please don't get occupied by this issue.
>
> It wants to check for a time string of the form: "[dd/mm/yy hh:mm:ss]"
> but $$ref has no value.
If that were true you would get a different warning message:
$ perl -wle'my $x; $x =~ /\d/'
Use of uninitialized value in pattern match (m//) at -e line 1.
John
--
use Perl;
program
fulfillment
------------------------------
Date: Wed, 14 Nov 2007 23:00:29 GMT
From: "John W. Krahn" <krahnj@telus.net>
Subject: Re: Use of uninitialized value in concatenation
Message-Id: <473B7DEE.96D27309@telus.net>
Peter Wyzl wrote:
>
> "gil" <gil.kovary@gmail.com> wrote in message
> news:1195075516.925803.65240@k79g2000hse.googlegroups.com...
> > when running Perl in "-w" mode, I get the following warning line:
> >
> > "Use of uninitialized value in concatenation (.) or string at ./
> > check_log.pl line 177, <DAT> line 261."
> >
> > when line 177 is:
> >
> > "if ($$ref =~ /^\[(\d+?)\/(\d+?)\/(\d+?)\s+?(\d+?):(\d+?):(\d+?)$
> > \]/)"
>
> It would appear that at some point $$ref becomes a null value.
If that were true you would get a different warning message.
$ perl -wle'my $x; $x =~ /\d/'
Use of uninitialized value in pattern match (m//) at -e line 1.
John
--
use Perl;
program
fulfillment
------------------------------
Date: Wed, 14 Nov 2007 11:23:02 -0800
From: sheinrich@my-deja.com
Subject: Re: Using fork()
Message-Id: <1195068182.111199.169390@19g2000hsx.googlegroups.com>
On Nov 13, 5:15 pm, Q <qal...@gmail.com> wrote:
> I'm trying to use fork and have the processes interact with each
> other... Is this possible? Something like:
>
> my $pid = fork();
> my $gotit = 0;
>
> if ($pid) {
> while (1) {
> if $gotit = 0 {
> <do a thing>
> $gotit = 1;
> }
> }} else {
>
> while (1) {
> my $input = <STDIN>;
> print $input;
> $gotit = 0; #when I get input, I want to set gotit back to 0 so
> the parent starts again.
> }
>
> }
>
> Is there a good way to accomplish this?
Some months ago I wrote a module for exactly this purpose.
You can get it from here (pod included):
http://www.atablis.com/temp/PreforkAgent.pm
Some other modules are in the CPAN Parallel namespace.
Cheers,
Steffen
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V11 Issue 1033
***************************************