[29701] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 945 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 17 16:09:49 2007

Date: Wed, 17 Oct 2007 13:09:10 -0700 (PDT)
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, 17 Oct 2007     Volume: 11 Number: 945

Today's topics:
        Creating Images  cylurian@gmail.com
    Re: Creating Images <wahab@chemie.uni-halle.de>
    Re: Creating Images <simon.chao@fmr.com>
        exclude list from list <jcharth@gmail.com>
    Re: exclude list from list <simon.chao@fmr.com>
    Re: exclude list from list <mritty@gmail.com>
    Re: Inline regex <uri@stemsystems.com>
        perl time function <lerameur@yahoo.com>
    Re: perl time function <josef.moellers@fujitsu-siemens.com>
    Re: perl time function <lerameur@yahoo.com>
    Re: perl time function <smallpond@juno.com>
    Re: perl time function <ben@morrow.me.uk>
    Re: perl time function <abigail@abigail.be>
    Re: perl time function <smallpond@juno.com>
    Re: perl time function <dn.perl@gmail.com>
    Re: perl Vs Shell <jurgenex@hotmail.com>
    Re: printing a subject line <cwilbur@chromatico.net>
        variable bewilderingly becomes undefined <taylor@metasyntax.net>
    Re: variable bewilderingly becomes undefined <simon.chao@fmr.com>
    Re: variable bewilderingly becomes undefined <taylor@metasyntax.net>
    Re: variable bewilderingly becomes undefined <simon.chao@fmr.com>
    Re: variable bewilderingly becomes undefined <paduille.4061.mumia.w+nospam@earthlink.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Wed, 17 Oct 2007 11:06:55 -0700
From:  cylurian@gmail.com
Subject: Creating Images
Message-Id: <1192644415.972707.6470@e9g2000prf.googlegroups.com>

I'm trying to print out math equations like, 1/x + 2/3x = 4 in html
via perl.  The problem is the denominator and numerator look funny.
Not only fractions, but square roots.  I want to know if there was an
easy tutorial on how to create images via perl.  Maybe I might be able
to create a nicely formated equations by creating an image.



------------------------------

Date: Wed, 17 Oct 2007 20:33:33 +0200
From: Mirco Wahab <wahab@chemie.uni-halle.de>
Subject: Re: Creating Images
Message-Id: <ff5khv$806$1@nserver.hrz.tu-freiberg.de>

cylurian@gmail.com wrote:
> I'm trying to print out math equations like, 1/x + 2/3x = 4 in html
> via perl.  The problem is the denominator and numerator look funny.
> Not only fractions, but square roots.  I want to know if there was an
> easy tutorial on how to create images via perl.  Maybe I might be able
> to create a nicely formated equations by creating an image.

Is this as part of a web app? If so (and you control
the server), you coul'd go for the maximum impact
and use a wrapper into Latex, like LaTeXRender.pm:
http://www.tangentspace.net/cz/archives/2005/04/latexrender-perl-port

Some time ago I wrote a mod_perl2 output filter that
grabs [LaTex] $E = mc^2$ [/LaTex] pseudotags from the
outgoing html stream, takes the content in between and
sends this to the (heavily modified for my purposes:)
LaTExRender.pm, which responds with a on-server link to
a generated (and cached) image of the equation (or a
complete TeX block); this <img> link is then inserted
at the positon of the pseudotag.

This works fine, e.g. here on a test account
http://phys.chemie.uni-halle.de/latex/sample.html
(it works, but nobody uses it)

Maybe thats the way to go?

Regards

M.


------------------------------

Date: Wed, 17 Oct 2007 19:54:39 -0000
From:  it_says_BALLS_on_your forehead <simon.chao@fmr.com>
Subject: Re: Creating Images
Message-Id: <1192650879.276570.240110@q3g2000prf.googlegroups.com>

On Oct 17, 2:33 pm, Mirco Wahab <wa...@chemie.uni-halle.de> wrote:
> cylur...@gmail.com wrote:
> > I'm trying to print out math equations like, 1/x + 2/3x = 4 in html
> > via perl.  The problem is the denominator and numerator look funny.
> > Not only fractions, but square roots.  I want to know if there was an
> > easy tutorial on how to create images via perl.  Maybe I might be able
> > to create a nicely formated equations by creating an image.
>
> Is this as part of a web app? If so (and you control
> the server), you coul'd go for the maximum impact
> and use a wrapper into Latex, like LaTeXRender.pm:http://www.tangentspace.net/cz/archives/2005/04/latexrender-perl-port
>
> Some time ago I wrote a mod_perl2 output filter that
> grabs [LaTex] $E = mc^2$ [/LaTex] pseudotags from the
> outgoing html stream, takes the content in between and
> sends this to the (heavily modified for my purposes:)
> LaTExRender.pm, which responds with a on-server link to
> a generated (and cached) image of the equation (or a
> complete TeX block); this <img> link is then inserted
> at the positon of the pseudotag.
>
> This works fine, e.g. here on a test accounthttp://phys.chemie.uni-halle.de/latex/sample.html
> (it works, but nobody uses it)

That's really cool :-).



------------------------------

Date: Wed, 17 Oct 2007 09:02:16 -0700
From:  joe <jcharth@gmail.com>
Subject: exclude list from list
Message-Id: <1192636936.263752.261610@i38g2000prf.googlegroups.com>

Hello is there a quick way to produce a list of emails that subtracts
a small list emails from a big list. Thanks.



------------------------------

Date: Wed, 17 Oct 2007 16:23:32 -0000
From:  it_says_BALLS_on_your forehead <simon.chao@fmr.com>
Subject: Re: exclude list from list
Message-Id: <1192638212.668010.210540@v29g2000prd.googlegroups.com>

On Oct 17, 12:02 pm, joe <jcha...@gmail.com> wrote:
> Hello is there a quick way to produce a list of emails that subtracts
> a small list emails from a big list. Thanks.

shove the big list in a hash, then for each item in the small list,
delete it from the hash.



------------------------------

Date: Wed, 17 Oct 2007 09:36:12 -0700
From:  Paul Lalli <mritty@gmail.com>
Subject: Re: exclude list from list
Message-Id: <1192638972.087099.273690@v23g2000prn.googlegroups.com>

On Oct 17, 12:02 pm, joe <jcha...@gmail.com> wrote:
> Hello is there a quick way to produce a list of emails that subtracts
> a small list emails from a big list. Thanks.

$ perldoc -q "difference of two arrays"
Found in /opt2/Perl5_8_4/lib/perl5/5.8.4/pod/perlfaq4.pod
     How do I compute the difference of two arrays?  How do I
     compute the intersection of two arrays?

     Use a hash.  Here's code to do both and more.  It assumes
     that each element is unique in a given array:

         @union = @intersection = @difference = ();
         %count = ();
         foreach $element (@array1, @array2) { $count{$element}++ }
         foreach $element (keys %count) {
             push @union, $element;
             push @{ $count{$element} > 1 ? \@intersection :
\@difference }, $element;
         }

     Note that this is the symmetric difference, that is, all
     elements in either A or in B but not in both.  Think of it
     as an xor operation.



------------------------------

Date: Wed, 17 Oct 2007 16:06:48 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Inline regex
Message-Id: <x7d4vdzpwn.fsf@mail.sysarch.com>

>>>>> "MW" == Mirco Wahab <wahab@chemie.uni-halle.de> writes:

  MW> Uri Guttman wrote:
  >>>>>>> "MW" == Mirco Wahab <wahab@chemie.uni-halle.de> writes:
  MW> Where the 'map' would (imho) make sense:
  MW> ...
  MW> my @trimmed = map /\s+$/ ? substr($_,0,$-[0]) : $_, @line;
  MW> ...
  >> why the extra code? just grab the text before the trailing spaces
  >> (untested):

  MW> This was made for "speedy design". I had "a million" of "big strings"
  MW> in mind - and tried to provide a practical, nondestructive version
  MW> that avoids unnecessary copying (see my last remark in my posting).

first rule of perl optimization is don't guess which is faster,
benchmark it. my experience says that running more perl code such as the
condition expression is slower than staying inside c in one m// op. but
there are many counterexamples to that (the famous trim front and back
code). the overhead for the copy may be less than the work done in the
extra perl code. also the length of the strings and how much is copied
will affect things. i just was showing a way do it with less perl code
on the good chance that it would be faster (definitely cleaner code IMO
too). and the idiom of mapping over list with a grabbing regex is a good
one to show and teach.

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, 17 Oct 2007 13:33:41 -0000
From:  lerameur <lerameur@yahoo.com>
Subject: perl time function
Message-Id: <1192628021.206920.275220@v29g2000prd.googlegroups.com>

Hello,

I know there are lot of function in perl.
Can somebody tell me which function does the following:
I have the : year, month, day, hours   I want to increment the hours
everytime the script is run. once the hours reaches 23 to 24 (actually
0), it will increment the days. My concerns are with leap years and
months

thanks
k



------------------------------

Date: Wed, 17 Oct 2007 16:33:43 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: perl time function
Message-Id: <ff56gj$doe$1@nntp.fujitsu-siemens.com>

lerameur wrote:
> Hello,
>=20
> I know there are lot of function in perl.
> Can somebody tell me which function does the following:
> I have the : year, month, day, hours   I want to increment the hours
> everytime the script is run. once the hours reaches 23 to 24 (actually
> 0), it will increment the days. My concerns are with leap years and
> months

See Date::Calc (Add_Delta_YMDHMS).

--=20
These are my personal views and not those of Fujitsu Siemens Computers!
Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize (T.  Pratchett)
Company Details: http://www.fujitsu-siemens.com/imprint.html



------------------------------

Date: Wed, 17 Oct 2007 14:52:50 -0000
From:  lerameur <lerameur@yahoo.com>
Subject: Re: perl time function
Message-Id: <1192632770.215089.186550@y27g2000pre.googlegroups.com>

On Oct 17, 10:33 am, Josef Moellers <josef.moell...@fujitsu-
siemens.com> wrote:
> lerameur wrote:
> > Hello,
>
> > I know there are lot of function in perl.
> > Can somebody tell me which function does the following:
> > I have the : year, month, day, hours   I want to increment the hours
> > everytime the script is run. once the hours reaches 23 to 24 (actually
> > 0), it will increment the days. My concerns are with leap years and
> > months
>
> See Date::Calc (Add_Delta_YMDHMS).
>
> --
> These are my personal views and not those of Fujitsu Siemens Computers!
> Josef M=F6llers (Pinguinpfleger bei FSC)
>         If failure had no penalty success would not be a prize (T.  Pratc=
hett)
> Company Details:http://www.fujitsu-siemens.com/imprint.html

I used the same localtime I used, but I added hours+1 so that it
output to another time variable and use that time to do my
calculation.
thanks



------------------------------

Date: Wed, 17 Oct 2007 08:13:09 -0700
From:  smallpond <smallpond@juno.com>
Subject: Re: perl time function
Message-Id: <1192633989.076451.140220@q3g2000prf.googlegroups.com>

On Oct 17, 9:33 am, lerameur <leram...@yahoo.com> wrote:
> Hello,
>
> I know there are lot of function in perl.
> Can somebody tell me which function does the following:
> I have the : year, month, day, hours   I want to increment the hours
> everytime the script is run. once the hours reaches 23 to 24 (actually
> 0), it will increment the days. My concerns are with leap years and
> months
>
> thanks
> k


Better to keep the time in seconds and use localtime to extract
year/month/day/hour.  Then you can just keep adding 3600 each
hour.  This way you don't have to reinvent what is probably the
most frequently reinvented wheel in application programming.

my $mytime = 1192633277;
use constant ONEHOUR => 3600;

$mytime += ONEHOUR;
@t = localtime($mytime);
($year, $month, $day, $hour) = @t[5,4,3,2];

--S






------------------------------

Date: Wed, 17 Oct 2007 16:53:14 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: perl time function
Message-Id: <aonhu4-761.ln1@osiris.mauzo.dyndns.org>


Quoth smallpond <smallpond@juno.com>:
> On Oct 17, 9:33 am, lerameur <leram...@yahoo.com> wrote:
> >
> > I know there are lot of function in perl.
> > Can somebody tell me which function does the following:
> > I have the : year, month, day, hours   I want to increment the hours
> > everytime the script is run. once the hours reaches 23 to 24 (actually
> > 0), it will increment the days. My concerns are with leap years and
> > months
> 
> Better to keep the time in seconds and use localtime to extract
> year/month/day/hour.  Then you can just keep adding 3600 each
> hour.  This way you don't have to reinvent what is probably the
> most frequently reinvented wheel in application programming.

Hours (or, at any rate, 'calendar hours') are not necessarily 3600
seconds long, because of leap seconds. When doing calendar calculations,
it's best to use a module that does it right.

Ben



------------------------------

Date: 17 Oct 2007 16:21:37 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: perl time function
Message-Id: <slrnfhcdkh.21q.abigail@alexandra.abigail.be>

                                       _
Ben Morrow (ben@morrow.me.uk) wrote on VCLX September MCMXCIII in
<URL:news:aonhu4-761.ln1@osiris.mauzo.dyndns.org>:
--  
--  Quoth smallpond <smallpond@juno.com>:
-- > On Oct 17, 9:33 am, lerameur <leram...@yahoo.com> wrote:
-- > >
-- > > I know there are lot of function in perl.
-- > > Can somebody tell me which function does the following:
-- > > I have the : year, month, day, hours   I want to increment the hours
-- > > everytime the script is run. once the hours reaches 23 to 24 (actually
-- > > 0), it will increment the days. My concerns are with leap years and
-- > > months
-- > 
-- > Better to keep the time in seconds and use localtime to extract
-- > year/month/day/hour.  Then you can just keep adding 3600 each
-- > hour.  This way you don't have to reinvent what is probably the
-- > most frequently reinvented wheel in application programming.
--  
--  Hours (or, at any rate, 'calendar hours') are not necessarily 3600
--  seconds long, because of leap seconds. When doing calendar calculations,
--  it's best to use a module that does it right.


Yeah, but if you have a system that using Unix time to do timestamps,
using a module that considers leapseconds will get you fucked, because
Unix doesn't know about leap seconds.

Considering leap seconds when doing data calculations is only useful
if your timestamps know about leap seconds in the first place. And
only if you need second precision in your answer.


Abigail
-- 
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'


------------------------------

Date: Wed, 17 Oct 2007 11:13:20 -0700
From:  smallpond <smallpond@juno.com>
Subject: Re: perl time function
Message-Id: <1192644800.458039.37600@q3g2000prf.googlegroups.com>

On Oct 17, 11:53 am, Ben Morrow <b...@morrow.me.uk> wrote:
> Quoth smallpond <smallp...@juno.com>:
>
> > On Oct 17, 9:33 am, lerameur <leram...@yahoo.com> wrote:
>
> > > I know there are lot of function in perl.
> > > Can somebody tell me which function does the following:
> > > I have the : year, month, day, hours   I want to increment the hours
> > > everytime the script is run. once the hours reaches 23 to 24 (actually
> > > 0), it will increment the days. My concerns are with leap years and
> > > months
>
> > Better to keep the time in seconds and use localtime to extract
> > year/month/day/hour.  Then you can just keep adding 3600 each
> > hour.  This way you don't have to reinvent what is probably the
> > most frequently reinvented wheel in application programming.
>
> Hours (or, at any rate, 'calendar hours') are not necessarily 3600
> seconds long, because of leap seconds. When doing calendar calculations,
> it's best to use a module that does it right.
>
> Ben


True.  You could be as much as 2 seconds off if the program had
been running for the last 10 years.  By the way, how would a
module know when leap seconds have been added?  Would it check
with IERS?  Which modules take leap seconds into account?
--S



------------------------------

Date: Wed, 17 Oct 2007 11:58:13 -0700
From:  "dn.perl@gmail.com" <dn.perl@gmail.com>
Subject: Re: perl time function
Message-Id: <1192647493.340572.269810@q3g2000prf.googlegroups.com>

On Oct 17, 8:53 am, Ben Morrow <b...@morrow.me.uk> wrote:
>
> Hours (or, at any rate, 'calendar hours') are not necessarily 3600
> seconds long, because of leap seconds. When doing calendar calculations,
> it's best to use a module that does it right.
>
> Ben
>

a) Who keeps track of these things so that the module works correct?
Just curious.

Let's say it is N seconds since 1-Jan-1970, 00:00:00 (or whatever the
base date-time), stored in variable t1, to 11:59:20 PM on date D, at
the end of which 2 leap seconds get added. Going by your post, it
looks like localtime($t1+45) would return 00:00:03 on date D+1 after
adjusting for 2 leap seconds. b) Is my deduction correct?

How many times have extra seconds been added or deducted since January
1970?



------------------------------

Date: Wed, 17 Oct 2007 15:54:49 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: perl Vs Shell
Message-Id: <dfqRi.2008$HU1.243@trndny07>

DriVE_mE_cRazY wrote:
> Can we write a perl script which does all the activities of a shell
> script?

Yes.

> If Yes what the advantage of using perl script in the place of
> shell script.Please explain me.

Two completely different tools. Shell scripts are good at stringing together 
and batch processing external commands but lack any higher-level programming 
features.
Perl on the other hand is a full-featured programming language that can also 
call external commands. But if the later is all you want to do then there is 
really hardly a good reason to rewrite your code in Perl.

> I'm working as a oracle DBA and i want
> to write the perl script for oracle db/apps cloning which was written
> in shell script.

Perl has several great modules to access databases directly and work with 
the data natively.

jue 




------------------------------

Date: 17 Oct 2007 10:37:01 -0400
From: Charlton Wilbur <cwilbur@chromatico.net>
Subject: Re: printing a subject line
Message-Id: <87tzopkdte.fsf@mithril.chromatico.net>

>>>>> "WW" == Wade Ward <zaxfuuq@invalid.net> writes:

    WW> This script has tested ok on its ability to grab a usenet
    WW> message.  Now I want to do soemthing with the subject, and I
    WW> don't see where I go wrong.  I think I get the subject into my
    WW> $string with: my $string1 = $_->[$subject_offset]; Perl.exe
    WW> says $string1 is unitialized in the ultimate print statement.
    WW> What gives?  

I recommend running it under the debugger to find out.  In particular,
you will be able to determine precisely whether you get the subject
into $string1 (which probably ought to be called, you know, $subject).

perldoc perldebtut

And consider use warnings; as well -- you're probably doing some
warnings-appropriate things there, but I'm not going to go through the
code to point them out when perl can do it automatically.

Charlton





-- 
Charlton Wilbur
cwilbur@chromatico.net


------------------------------

Date: Wed, 17 Oct 2007 09:54:00 -0400
From: Taylor Venable <taylor@metasyntax.net>
Subject: variable bewilderingly becomes undefined
Message-Id: <ff541n$pob$1@registered.motzarella.org>

Hello all,

I have some text in a file, that I'm scanning over and pulling out of
columns for use in some graphs.  One piece of the code, however, is
bothering me because a variable seems to suddenly become undefined for no
reason.  Here's the code:

        my $i = 0;
385:    while ($i < $timeMax + .01) {
            print "DOOD - timeMax undef!\n" if (not defined $timeMax);
            print "$i:$timeMax";
            unshift @xs, $i;
            unshift @ys, scalar (grep { $_ > $i && $_ < $i + 0.01 } @times);
390:        $i += .01;
        }

This is for a histogram graph, so I'm finding the number of entries in the
data set that fall in the current range, starting at zero and going up
until the maximum.  I know it's not perfect, but for now I'd settle for any
results period, because at the moment the output is:

0.35:0.380084
0.36:0.380084
0.37:0.380084
0.38:0.380084
0.39:0.380084
Use of uninitialized value in addition (+) at ./stress.pl line 385,
<$opt{...}> line 20.
DOOD - timeMax undef!
Use of uninitialized value in concatenation (.) or string at ./stress.pl
line 387, <$opt{...}> line 20.
0:Use of uninitialized value in addition (+) at ./stress.pl line 390,
<$opt{...}> line 20.

So it seems that $timeMax is suddenly undef'd while inside the loop.  How
can this be?  The numbers I'm pulling from the file are at the end of the
line and haven't been chomp()'d, but I wouldn't think that should matter.

Great thanks for any help.

Taylor Venable


------------------------------

Date: Wed, 17 Oct 2007 14:13:25 -0000
From:  it_says_BALLS_on_your forehead <simon.chao@fmr.com>
Subject: Re: variable bewilderingly becomes undefined
Message-Id: <1192630405.193187.157200@q3g2000prf.googlegroups.com>

On Oct 17, 9:54 am, Taylor Venable <tay...@metasyntax.net> wrote:
> Hello all,
>
> I have some text in a file, that I'm scanning over and pulling out of
> columns for use in some graphs.  One piece of the code, however, is
> bothering me because a variable seems to suddenly become undefined for no
> reason.  Here's the code:
>
>         my $i = 0;
> 385:    while ($i < $timeMax + .01) {
>             print "DOOD - timeMax undef!\n" if (not defined $timeMax);
>             print "$i:$timeMax";
>             unshift @xs, $i;
>             unshift @ys, scalar (grep { $_ > $i && $_ < $i + 0.01 } @times);
> 390:        $i += .01;
>         }
>
> This is for a histogram graph, so I'm finding the number of entries in the
> data set that fall in the current range, starting at zero and going up
> until the maximum.  I know it's not perfect, but for now I'd settle for any
> results period, because at the moment the output is:
>
> 0.35:0.380084
> 0.36:0.380084
> 0.37:0.380084
> 0.38:0.380084
> 0.39:0.380084
> Use of uninitialized value in addition (+) at ./stress.pl line 385,
> <$opt{...}> line 20.
> DOOD - timeMax undef!
> Use of uninitialized value in concatenation (.) or string at ./stress.pl
> line 387, <$opt{...}> line 20.
> 0:Use of uninitialized value in addition (+) at ./stress.pl line 390,
> <$opt{...}> line 20.
>
> So it seems that $timeMax is suddenly undef'd while inside the loop.  How
> can this be?  The numbers I'm pulling from the file are at the end of the
> line and haven't been chomp()'d, but I wouldn't think that should matter.


perhaps $timeMax is a global variable that gets undefined somewhere
else? i understand that you want to focus on the block of code where
the problem is manifesting itself, but in this case I would think that
any code that references $timeMax could be relevant.



------------------------------

Date: Wed, 17 Oct 2007 10:26:45 -0400
From: Taylor Venable <taylor@metasyntax.net>
Subject: Re: variable bewilderingly becomes undefined
Message-Id: <ff55v2$3mu$1@registered.motzarella.org>

it_says_BALLS_on_your forehead wrote:

> perhaps $timeMax is a global variable that gets undefined somewhere
> else? i understand that you want to focus on the block of code where
> the problem is manifesting itself, but in this case I would think that
> any code that references $timeMax could be relevant.

That is one of the things that confounds me: it is local to the subroutine
in which this all occurs (declared with "my"), it is only assigned once,
and it is not a reference.  The value is the result of a "max" function,
defined as:

sub max($) {
    my $list = shift;
    my $max = $$list[0];
    foreach my $elt (@$list) {
        $max = $elt if ($elt > $max);
    }
    return $max;
}

The definition of timeMax is:

my $timeMax = max(\@timing);  # where @timing contains the timing data

So I don't think this should be making timeMax a refernce, should it?  And
although a lot of the code is parallelized, this part is only executed once
per program run.


------------------------------

Date: Wed, 17 Oct 2007 14:37:05 -0000
From:  it_says_BALLS_on_your forehead <simon.chao@fmr.com>
Subject: Re: variable bewilderingly becomes undefined
Message-Id: <1192631825.133867.284590@i13g2000prf.googlegroups.com>

On Oct 17, 10:26 am, Taylor Venable <tay...@metasyntax.net> wrote:
> it_says_BALLS_on_your forehead wrote:
> > perhaps $timeMax is a global variable that gets undefined somewhere
> > else? i understand that you want to focus on the block of code where
> > the problem is manifesting itself, but in this case I would think that
> > any code that references $timeMax could be relevant.
>
> That is one of the things that confounds me: it is local to the subroutine
> in which this all occurs (declared with "my"), it is only assigned once,
> and it is not a reference.  The value is the result of a "max" function,
> defined as:
>
> sub max($) {
>     my $list = shift;
>     my $max = $$list[0];
>     foreach my $elt (@$list) {
>         $max = $elt if ($elt > $max);
>     }
>     return $max;
>
> }
>
> The definition of timeMax is:
>
> my $timeMax = max(\@timing);  # where @timing contains the timing data
>
> So I don't think this should be making timeMax a refernce, should it?  And
> although a lot of the code is parallelized, this part is only executed once
> per program run.

what happens if you print Dumper( \@timing ) before and after each
time your max sub is called?



------------------------------

Date: Wed, 17 Oct 2007 11:01:18 -0500
From: "Mumia W." <paduille.4061.mumia.w+nospam@earthlink.net>
Subject: Re: variable bewilderingly becomes undefined
Message-Id: <13hcdn45mkeuc30@corp.supernews.com>

On 10/17/2007 09:26 AM, Taylor Venable wrote:
> [...]
> The definition of timeMax is:
> 
> my $timeMax = max(\@timing);  # where @timing contains the timing data
> 
> So I don't think this should be making timeMax a refernce, should it?  And
> although a lot of the code is parallelized, this part is only executed once
> per program run.

What do you mean by parallelized?


------------------------------

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 945
**************************************


home help back first fref pref prev next nref lref last post