[25318] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7563 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Dec 23 18:05:53 2004

Date: Thu, 23 Dec 2004 15:05:13 -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           Thu, 23 Dec 2004     Volume: 10 Number: 7563

Today's topics:
        [OT] kill/killall (was: Perl interface to Unix ps?) <kkeller-usenet@wombat.san-francisco.ca.us>
        File::Remote <dontwannasay@home.com>
        hashref strange side effects <cal@not.splitreflection.com>
    Re: hashref strange side effects <cal@not.splitreflection.com>
    Re: hashref strange side effects (Anno Siegel)
    Re: How can script find its host's name/IP address? <tadmc@augustmail.com>
    Re: How can script find its host's name/IP address? <matthew.garrish@sympatico.ca>
    Re: How can script find its host's name/IP address? <karlUNDERSCOREkramsch@yahooPERIODcom.invalid>
    Re: Is zero even or odd? <see@sig.com>
    Re: Is zero even or odd? <see@sig.com>
    Re: Is zero even or odd? <dirk@neopax.com>
    Re: Is zero even or odd? <see@sig.com>
    Re: Is zero even or odd? <see@sig.com>
    Re: Is zero even or odd? <jmw@jmwa.demon.contraspam.yuk>
    Re: Is zero even or odd? <wallace.k@engr.orst.edNOSPAMu>
    Re: Is zero even or odd? <invalid@msgid.michael.mendelsohn.de>
    Re: Is zero even or odd? <george_coxanti@spambtinternet.com.invalid>
    Re: Is zero even or odd? <jfields@austininstruments.com>
        perl lacks the n of sh's "shift n" <jidanni@jidanni.org>
    Re: reformatting linewrapped e-mail messages. <terrylr@blauedonau.com>
    Re: reformatting linewrapped e-mail messages. <noreply@gunnar.cc>
    Re: Reinitializing Size of Anonymous Array <jgibson@mail.arc.nasa.gov>
    Re: Saving regex to new variable <tadmc@augustmail.com>
    Re: Saving regex to new variable <jgibson@mail.arc.nasa.gov>
        Use of uninitialized value in split ? <lance-news@augustmail.com>
    Re: Use of uninitialized value in split ? <perl@my-header.org>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 23 Dec 2004 12:16:05 -0800
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: [OT] kill/killall (was: Perl interface to Unix ps?)
Message-Id: <5llr92x3m2.ln2@goaway.wombat.san-francisco.ca.us>

On 2004-12-23, Jim Gibson <jgibson@mail.arc.nasa.gov> wrote:
>
> There is also the Unix killall utility:
>
>    killall -USR1 programname

Apparently killall does not behave the same way on every OS: there are
some notes on Solaris killall, for example, that suggest it's a bit more
extreme (it kills all processes, thus killall).

--keith

-- 
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom



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

Date: Thu, 23 Dec 2004 22:45:53 GMT
From: Mike <dontwannasay@home.com>
Subject: File::Remote
Message-Id: <Xns95C8963291A76dontwannasaycom@63.240.76.16>

Hi All:

What is the trick to this module?  My goal is to update files on remote 
systems.  However, when I try to open a file, it fails.  Every time.

I tried the...
use File::Remote wq(:replace);
 ...structure and the plain...
use File::Remote;
 ...as well.

open (REMOTE, "junior:/etc/oratab") or die;
 ...just dies.

Any suggestions?

Thanks,
Mike


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

Date: Thu, 23 Dec 2004 11:24:25 -0800
From: penguinista <cal@not.splitreflection.com>
Subject: hashref strange side effects
Message-Id: <41cb1b68$0$19046$d368eab@news.calweb.com>

# load a map into memory
sub readmap
{ my ($map, $file) = @_; # $map is a hashref here
   my ($line, $type, $name);
   return if eof $file;
   $line = <$file>;
   chomp $line;
   if ($line =~ /\{\s*(\w+)\s+(\w+)/)
   { $type = $1; $name = $2;
     if (!defined($map->{$name}))
     { $map->{$name} = {'parent'=>$map, 'name'=>$name, 'type'=>$type}; }
     &readmap($map->{$name}, $file);
   }
   elsif ( $line =~ /(\w+)=(.+)/ )
   { $map->{$1} = $2; # this sets field value, then shoots off to garbage
   }
   elsif ($line =~ /\}/)
   { return; }
   else {}; # error
}

It the above subroutine, the line $map->{$1} = $2 assigns key+value into 
the hash as expected, then shoots off to a sub DESTROY {} in package 
IO::Handle; before returning to my code after the call to the subroutine 
that first calls recursive routine readmap.  $1 = 'val', $2 = '"Login"'

running perl 5.8.5 in cygwin.

any ideas?


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

Date: Thu, 23 Dec 2004 12:08:07 -0800
From: penguinista <cal@not.splitreflection.com>
Subject: Re: hashref strange side effects
Message-Id: <41cb25a6$0$19041$d368eab@news.calweb.com>

penguinista wrote:

> # load a map into memory
> sub readmap
> { my ($map, $file) = @_; # $map is a hashref here
>   my ($line, $type, $name);
>   return if eof $file;
>   $line = <$file>;
>   chomp $line;
>   if ($line =~ /\{\s*(\w+)\s+(\w+)/)
>   { $type = $1; $name = $2;
>     if (!defined($map->{$name}))
>     { $map->{$name} = {'parent'=>$map, 'name'=>$name, 'type'=>$type}; }
>     &readmap($map->{$name}, $file);
>   }
>   elsif ( $line =~ /(\w+)=(.+)/ )
>   { $map->{$1} = $2; # this sets field value, then shoots off to garbage
>   }
>   elsif ($line =~ /\}/)
>   { return; }
>   else {}; # error
> }
> 
> It the above subroutine, the line $map->{$1} = $2 assigns key+value into 
> the hash as expected, then shoots off to a sub DESTROY {} in package 
> IO::Handle; before returning to my code after the call to the subroutine 
> that first calls recursive routine readmap.  $1 = 'val', $2 = '"Login"'
> 
> running perl 5.8.5 in cygwin.
> 
> any ideas?

Looks like I forgot the itteration loop.  still doesn't quite explain 
the debugger results.


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

Date: 23 Dec 2004 20:19:08 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: hashref strange side effects
Message-Id: <cqf97s$6qq$1@mamenchi.zrz.TU-Berlin.DE>

penguinista  <cal@not.splitreflection.com> wrote in comp.lang.perl.misc:
> # load a map into memory
> sub readmap
> { my ($map, $file) = @_; # $map is a hashref here
>    my ($line, $type, $name);
>    return if eof $file;
>    $line = <$file>;
>    chomp $line;
>    if ($line =~ /\{\s*(\w+)\s+(\w+)/)
>    { $type = $1; $name = $2;
>      if (!defined($map->{$name}))
>      { $map->{$name} = {'parent'=>$map, 'name'=>$name, 'type'=>$type}; }
>      &readmap($map->{$name}, $file);
>    }
>    elsif ( $line =~ /(\w+)=(.+)/ )
>    { $map->{$1} = $2; # this sets field value, then shoots off to garbage
>    }
>    elsif ($line =~ /\}/)
>    { return; }
>    else {}; # error
> }
> 
> It the above subroutine, the line $map->{$1} = $2 assigns key+value into 
> the hash as expected, then shoots off to a sub DESTROY {} in package 
> IO::Handle; before returning to my code after the call to the subroutine 
> that first calls recursive routine readmap.  $1 = 'val', $2 = '"Login"'
> 
> running perl 5.8.5 in cygwin.
> 
> any ideas?

Presumably the file handle in $file goes out of scope on return from
that call.  The line you mention just happens to be the last line
executed in the sub.  There's nothing mysterious about it.  Why is
it bothering you?

Anno


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

Date: Thu, 23 Dec 2004 12:57:56 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: How can script find its host's name/IP address?
Message-Id: <slrncsm59k.1n0.tadmc@magna.augustmail.com>

Matt Garrish <matthew.garrish@sympatico.ca> wrote:
> "KKramsch" <karlUNDERSCOREkramsch@yahooPERIODcom.invalid> wrote in message 
> news:cqei5u$ds9$1@reader1.panix.com...
>>
>>>"kj" <socyl@987jk.com.invalid> wrote in message
>>>news:cqdc0l$4dd$1@reader1.panix.com...
>>>>
>>>> How can script find the hostname (or at least the IP address) of
>                             ^^^^^^^^ 
> ^^^^^^^^^^^^
>>>> the host it is running on?


> print $ENV{SERVER_NAME};
> 
> or if you're on IIS using asp


Perl is not CGI.

CGI is not Perl.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Thu, 23 Dec 2004 16:22:09 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: How can script find its host's name/IP address?
Message-Id: <0GGyd.15989$Z%3.904017@news20.bellglobal.com>


"Tad McClellan" <tadmc@augustmail.com> wrote in message 
news:slrncsm59k.1n0.tadmc@magna.augustmail.com...
> Matt Garrish <matthew.garrish@sympatico.ca> wrote:
>> "KKramsch" <karlUNDERSCOREkramsch@yahooPERIODcom.invalid> wrote in 
>> message
>> news:cqei5u$ds9$1@reader1.panix.com...
>>>
>>>>"kj" <socyl@987jk.com.invalid> wrote in message
>>>>news:cqdc0l$4dd$1@reader1.panix.com...
>>>>>
>>>>> How can script find the hostname (or at least the IP address) of
>>                             ^^^^^^^^
>> ^^^^^^^^^^^^
>>>>> the host it is running on?
>
>
>> print $ENV{SERVER_NAME};
>>
>> or if you're on IIS using asp
>
>
> Perl is not CGI.
>
> CGI is not Perl.
>

I never would have guessed...

I read the OP's poor first attempt at a question as a stealth cgi question. 
If I'm wrong on that account; I'm wrong. However, contrary to the followup 
reply, there most definitely *is* an environment variable *in the cgi 
environment* to find the hostname. Clearer?

Matt 




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

Date: Thu, 23 Dec 2004 22:45:15 +0000 (UTC)
From: KKramsch <karlUNDERSCOREkramsch@yahooPERIODcom.invalid>
Subject: Re: How can script find its host's name/IP address?
Message-Id: <cqfhpr$oce$1@reader1.panix.com>

In <0GGyd.15989$Z%3.904017@news20.bellglobal.com> "Matt Garrish" <matthew.garrish@sympatico.ca> writes:


>"Tad McClellan" <tadmc@augustmail.com> wrote in message 
>news:slrncsm59k.1n0.tadmc@magna.augustmail.com...
>> Matt Garrish <matthew.garrish@sympatico.ca> wrote:
>>> "KKramsch" <karlUNDERSCOREkramsch@yahooPERIODcom.invalid> wrote in 
>>> message
>>> news:cqei5u$ds9$1@reader1.panix.com...
>>>>
>>>>>"kj" <socyl@987jk.com.invalid> wrote in message
>>>>>news:cqdc0l$4dd$1@reader1.panix.com...
>>>>>>
>>>>>> How can script find the hostname (or at least the IP address) of
>>>                             ^^^^^^^^
>>> ^^^^^^^^^^^^
>>>>>> the host it is running on?
>>
>>
>>> print $ENV{SERVER_NAME};
>>>
>>> or if you're on IIS using asp
>>
>>
>> Perl is not CGI.
>>
>> CGI is not Perl.
>>

>I never would have guessed...

>I read the OP's poor first attempt at a question as a stealth cgi question. 
>If I'm wrong on that account; I'm wrong. However, contrary to the followup 
>reply, there most definitely *is* an environment variable *in the cgi 
>environment* to find the hostname. Clearer?

Before you get your panties in a wad, read my "followup reply"
again: I need not mention CGI either (because I did not read the
original post a "stealth cgi question").

	Karl

-- 
Sent from a spam-bucket account; I check it once in a blue moon.  If
you still want to e-mail me, cut out the extension from my address,
and make the obvious substitutions on what's left.


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

Date: Thu, 23 Dec 2004 19:46:06 GMT
From: "Nicholas O. Lindan" <see@sig.com>
Subject: Re: Is zero even or odd?
Message-Id: <2gFyd.11473$Z47.7884@newsread2.news.atl.earthlink.net>

"John W. Kennedy" <jwkenne@attglobal.net> wrote

> > But the size of the set of real numbers is Aleph 1 (oo^2).
> Aleph-1 is at least aleph-null^aleph-null.

Quite right, slip of the fingers (probably the mind, but I
always blame it on the fingers).  

Should read ... Aleph 1 (oo^oo) ...

-- 
Nicholas O. Lindan, Cleveland, Ohio
Consulting Engineer:  Electronics; Informatics; Photonics.
Remove spaces etc. to reply: n o lindan at net com dot com
psst.. want to buy an f-stop timer? nolindan.com/da/fstop/


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

Date: Thu, 23 Dec 2004 19:48:08 GMT
From: "Nicholas O. Lindan" <see@sig.com>
Subject: Re: Is zero even or odd?
Message-Id: <YhFyd.11474$Z47.2358@newsread2.news.atl.earthlink.net>

"Dave Seaman" <dseaman@no.such.host> wrote
> On Thu, 23 Dec 2004 12:22:02 -0500, John W. Kennedy wrote:
> > Aleph-1 is at least aleph-null^aleph-null.
> 
> No, it's the other way around.  Since aleph_1 is by definition the
> smallest uncountable cardinal, and since the reals are uncountable, it
> follows that c (= 2^aleph_0 = aleph_0^aleph_0), the cardinality of the
> continuum, cannot be less than aleph_1.  On the other hand, it could be
> that c is quite huge among the alephs.

I'm lost.

-- 
Nicholas O. Lindan, Cleveland, Ohio
Consulting Engineer:  Electronics; Informatics; Photonics.
Remove spaces etc. to reply: n o lindan at net com dot com
psst.. want to buy an f-stop timer? nolindan.com/da/fstop/


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

Date: Thu, 23 Dec 2004 19:54:20 +0000
From: Dirk Bruere at Neopax <dirk@neopax.com>
Subject: Re: Is zero even or odd?
Message-Id: <330m3dF3p9s2pU8@individual.net>

Kevin Aylward wrote:

> Dirk Bruere at Neopax wrote:
> 
>>Gordon Weast wrote:
>>
>>
>>>Another is renormalization theory in QED (Quantum Electrodynamics).
>>>There are several infinities in the theory that appeared to make
>>>the results nonsense.  However, if you keep track very carefully,
>>>you can get the infinities to cancel and come up with predictions
>>>that match measurements very accurately.
>>
>>And physicists think it an ugly bodge.
> 
> 
> Actually, I think the physicists think its just a bit annoying, its the 
> mathematicians that think its the ugly bodge.
> 
> 
>>Clearly the infinities are
>>failures of the theory,
> 
> 
> Or a failure of the mathematics.

Is there a difference?

-- 
Dirk

The Consensus:-
The political party for the new millenium
http://www.theconsensus.org


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

Date: Thu, 23 Dec 2004 19:56:18 GMT
From: "Nicholas O. Lindan" <see@sig.com>
Subject: Re: Is zero even or odd?
Message-Id: <CpFyd.11478$Z47.6956@newsread2.news.atl.earthlink.net>

"Michael Mendelsohn" <invalid@msgid.michael.mendelsohn.de> wrote 

> If in measuring a resistor, we find 0.0A at 0.0V, is the resistance 1
> Ohm, then?

Touche.

But, yes, I'll say it is 1, just not in conventional ohms.  
At 0.0A and 0.0V any scaling factor can apply to the volts 
and amps without changing the measurement:
 
1 new volt / 1 new amp = new value of the resistor.

0 new volts / 0 new amps = 1 * (1 volt / 1 amp) = new value of the resistor.

Value of the resistor = 1 new ohm.

-- 
Nicholas O. Lindan, Cleveland, Ohio
Consulting Engineer:  Electronics; Informatics; Photonics.
Remove spaces etc. to reply: n o lindan at net com dot com
psst.. want to buy an f-stop timer? nolindan.com/da/fstop/


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

Date: Thu, 23 Dec 2004 19:58:42 GMT
From: "Nicholas O. Lindan" <see@sig.com>
Subject: Re: Is zero even or odd?
Message-Id: <SrFyd.11480$Z47.9388@newsread2.news.atl.earthlink.net>

"Jamie" <jamie_5_not_valid_after_5_Please@charter.net> wrote

> if your dealing with microprocessor code a simple Bit test of bit 0 
> (first bit) will tell you if the value is Odd/even..
> if its on its Odd value otherwise its Even. and that covers the
> zero problem.

Once more, a PIC saves the day!

   Cheers from the crowds ...

-- 
Nicholas O. Lindan, Cleveland, Ohio
Consulting Engineer:  Electronics; Informatics; Photonics.
Remove spaces etc. to reply: n o lindan at net com dot com
psst.. want to buy an f-stop timer? nolindan.com/da/fstop/


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

Date: Thu, 23 Dec 2004 20:18:14 +0000
From: John Woodgate <jmw@jmwa.demon.contraspam.yuk>
Subject: Re: Is zero even or odd?
Message-Id: <aCWzWyLGgyyBFwNC@jmwa.demon.co.uk>

I read in sci.electronics.design that Nicholas O. Lindan <see@sig.com>
wrote (in <YhFyd.11474$Z47.2358@newsread2.news.atl.earthlink.net>) about
'Is zero even or odd?', on Thu, 23 Dec 2004:
>"Dave Seaman" <dseaman@no.such.host> wrote 
>> On Thu, 23 Dec 2004 12:22:02 -0500, John W. Kennedy wrote:
>> > Aleph-1 is at least aleph-null^aleph-null.
>> 
>> No, it's the other way around.  Since aleph_1 is by definition the
>> smallest uncountable cardinal, and since the reals are uncountable, it
>> follows that c (= 2^aleph_0 = aleph_0^aleph_0), the cardinality of the
>> continuum, cannot be less than aleph_1.  On the other hand, it could be
>> that c is quite huge among the alephs.
>
>I'm lost.

You need to study the math of infinities. Aleph-null is the smallest
infinity, and whatever you do to it with finite numbers doesn't change
it. Many operations with itself, even, don't change it. But raising it
to its power, {-}o^({-}o), creates a new infinity with different
properties. Although it's called aleph-one, no-one knows whether it is
the *next* infinity after aleph-null, or whether there are other
infinities in between.

No, I can't say I *understand* it either. The above was written in
parrot mode.
-- 
Regards, John Woodgate, OOO - Own Opinions Only. 
The good news is that nothing is compulsory.
The bad news is that everything is prohibited.
http://www.jmwa.demon.co.uk Also see http://www.isce.org.uk 


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

Date: Thu, 23 Dec 2004 12:38:10 -0800
From: k wallace <wallace.k@engr.orst.edNOSPAMu>
Subject: Re: Is zero even or odd?
Message-Id: <ifqdnQttUdkzsVbcRVn-qg@comcast.com>

Nicholas O. Lindan wrote:
> John Fields wrote:
> 
>>                  OXO
>>                   -
>>                   |.
>>                   | .
>>                   |   .
>>                   |      .
>>         --.------0,0--------
>>             .     |
>>               .   |
>>                 . |
>>                  .|
>>                   -
>>
>>                   -
>>                   |
>>                  OXO
> 
> 
> 
> One infinity, one zero.  +oo == -oo; +0 == -0.  Neither
> actually exist and you can approach from the direction of
> your choice.

lol- pre-coffee, I read this to say "neither of you actually exist..."
one of the better refutations I've seen on Usenet, I was thinking, and 
then I reread.
Ok, continue on..
-kwallace

> 
> From the graph I would say 1/0 is oo.
> 
> Somebody wrote a whole book on '0', I have (had?) a copy
> but darned if I can find it.
> 


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

Date: Thu, 23 Dec 2004 22:45:26 +0100
From: Michael Mendelsohn <invalid@msgid.michael.mendelsohn.de>
Subject: Re: Is zero even or odd?
Message-Id: <41CB3C76.D7CF5E00@msgid.michael.mendelsohn.de>

"Nicholas O. Lindan" schrieb:
> "Michael Mendelsohn" <invalid@msgid.michael.mendelsohn.de> wrote
> > If in measuring a resistor, we find 0.0A at 0.0V, is the resistance 1
> > Ohm, then?
> 
> Touche.
> 
> But, yes, I'll say it is 1, just not in conventional ohms.
> At 0.0A and 0.0V any scaling factor can apply to the volts
> and amps without changing the measurement:
> 
> 1 new volt / 1 new amp = new value of the resistor.
> 
> 0 new volts / 0 new amps = 1 * (1 volt / 1 amp) = new value of the resistor.
> 
> Value of the resistor = 1 new ohm.

When checking it turned out that some thief had actually stolen the
resistor where 0V,0A was measured. The circuit was broken, but noone
noticed because the voltage was zero.

Hence, vacuum/an insulator/air has a resistance of 1 new Ohm?

Cheers
Michael

-- 
Still an attentive ear he lent        Her speech hath caused this pain
But could not fathom what she meant   Easier I count it to explain
She was not deep, nor eloquent.       The jargon of the howling main
                 -- from Lewis Carroll: The Three Usenet Trolls


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

Date: Thu, 23 Dec 2004 22:00:35 +0000 (UTC)
From: George Cox <george_coxanti@spambtinternet.com.invalid>
Subject: Re: Is zero even or odd?
Message-Id: <41CB4002.7CDD7AC1@spambtinternet.com.invalid>

John Woodgate wrote:
> 
> I read in sci.electronics.design that Nicholas O. Lindan <see@sig.com>
> wrote (in <YhFyd.11474$Z47.2358@newsread2.news.atl.earthlink.net>) about
> 'Is zero even or odd?', on Thu, 23 Dec 2004:
> >"Dave Seaman" <dseaman@no.such.host> wrote
> >> On Thu, 23 Dec 2004 12:22:02 -0500, John W. Kennedy wrote:
> >> > Aleph-1 is at least aleph-null^aleph-null.
> >>
> >> No, it's the other way around.  Since aleph_1 is by definition the
> >> smallest uncountable cardinal, and since the reals are uncountable, it
> >> follows that c (= 2^aleph_0 = aleph_0^aleph_0), the cardinality of the
> >> continuum, cannot be less than aleph_1.  On the other hand, it could be
> >> that c is quite huge among the alephs.
> >
> >I'm lost.
> 
> You need to study the math of infinities. Aleph-null is the smallest
> infinity, and whatever you do to it with finite numbers doesn't change
> it. Many operations with itself, even, don't change it. But raising it
> to its power, {-}o^({-}o), creates a new infinity with different
> properties. Although it's called aleph-one, no-one knows whether it is
> the *next* infinity after aleph-null, or whether there are other
> infinities in between.

Whether (aleph_0)^{aleph_0} = aleph_1 or not isn't decided in the usual
set theories.

aleph_1 is the next infinity after aleph_0 (given the axiom of choice),
the question is, is 2^{aleph_0} the next infinity after aleph_0?  (And
generally, is 2^{aleph_{alpha}} the next infinity after aleph_{alpha}?)


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

Date: Thu, 23 Dec 2004 16:16:15 -0600
From: John Fields <jfields@austininstruments.com>
Subject: Re: Is zero even or odd?
Message-Id: <62gms0hcr7p45206af9oi31fr60ou7f0pl@4ax.com>

On Thu, 23 Dec 2004 22:45:26 +0100, Michael Mendelsohn
<invalid@msgid.michael.mendelsohn.de> wrote:

>"Nicholas O. Lindan" schrieb:
>> "Michael Mendelsohn" <invalid@msgid.michael.mendelsohn.de> wrote
>> > If in measuring a resistor, we find 0.0A at 0.0V, is the resistance 1
>> > Ohm, then?
>> 
>> Touche.
>> 
>> But, yes, I'll say it is 1, just not in conventional ohms.
>> At 0.0A and 0.0V any scaling factor can apply to the volts
>> and amps without changing the measurement:
>> 
>> 1 new volt / 1 new amp = new value of the resistor.
>> 
>> 0 new volts / 0 new amps = 1 * (1 volt / 1 amp) = new value of the resistor.
>> 
>> Value of the resistor = 1 new ohm.
>
>When checking it turned out that some thief had actually stolen the
>resistor where 0V,0A was measured. The circuit was broken, but noone
>noticed because the voltage was zero.

---
AHA! Pilot error!

In truth, the E in 

               E
          R = ---
               I

refers to the voltage _across_ the resistor, (a shunt, was it?) which
you didn't measure.  What you measured was the voltage from the low
side of where the resistor was supposed to be to ground, which gave
you zero volts which corresponded, also, to zero amps.  Had you
measured the voltage _across_ where the resistor was supposed to be
you would have measured the entire supply voltage minus what was being
dropped across the load by the current flowing through the meter and
you would have concluded that by subtracting the meter current that
you would have had:

               E     E
          R = --- = --- = oo
               I     0

Which would have been right!
   
>Hence, vacuum/an insulator/air has a resistance of 1 new Ohm?

---
Aaarrghhhh!!!  NONONONONO, Please!!! Don't stick beans in your nose...

-- 
John Fields


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

Date: Thu, 23 Dec 2004 23:28:37 +0800
From: Dan Jacobson <jidanni@jidanni.org>
Subject: perl lacks the n of sh's "shift n"
Message-Id: <874qidrq3e.fsf@jidanni.org>

Is it no great loss that perl lacks the n of sh's "shift n"?
I suppose there are two cases, one where we are sure we can indeed
shift n times, use for (1..$n){shift @F} I suppose, and one where we are
worried we will run out of parameters.


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

Date: Thu, 23 Dec 2004 15:17:51 -0600
From: "terry l. ridder" <terrylr@blauedonau.com>
Subject: Re: reformatting linewrapped e-mail messages.
Message-Id: <Pine.LNX.4.61.0412231515570.310@johann.blauedonau.com>

hello;

terrylr> terry l. ridder wrote:
terrylr> > i am attempting to create a searchable archive of an e-mail list that
terrylr> > i am a member of. i have been able to either use existing perl modules
terrylr> > or write perl scripts to perform most of the message checking and
terrylr> > reformatting.

On Thu, 23 Dec 2004, Gunnar Hjalmarsson wrote:
gunnar> 
gunnar> Have you checked out http://www.mhonarc.org/ ?
gunnar> 
gunnar> > what is giving me problems are the linewrapped replies.
gunnar> > i am searching for a way in perl to reformat the linewrapped replies.
gunnar> 
gunnar> You may want to check out if, and then how, that issue is handled by
gunnar> MHonArc.
gunnar> 
gunnar> 

mhonarc does not do any reformatting on linewrapped mangled messages.
been there, done that, does not work.

-- 
terry l. ridder ><>


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

Date: Thu, 23 Dec 2004 23:36:37 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: reformatting linewrapped e-mail messages.
Message-Id: <330vgnF3nq1q9U1@individual.net>

terry l. ridder wrote:
> Gunnar Hjalmarsson wrote:
>> terry l. ridder wrote:
>>> what is giving me problems are the linewrapped replies. i am
>>> searching for a way in perl to reformat the linewrapped replies.
>> 
>> You may want to check out if, and then how, that issue is handled
>> by MHonArc.
> 
> mhonarc does not do any reformatting on linewrapped mangled messages.
> been there, done that, does not work.

Okay. Maybe there is a reason, btw. Given something like this:

>> aldfldksfj söldkf jalskef jölsakdjf öakdf jölsakdj föasldjföaldf
> abcdef
> 
> qpwerpqweri åpqwei råpqowei råpoqwie råpoqwieråpoiqweåproiqwåepo

is there really any safe way to tell whether the string 'abcdef' belongs
to the previos line, or if it's the beginning of the comment on that
line? Maybe there is no safe way to compensate for this sort of
shortcomings in various MUA's and/or their users' limited skill?

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: Thu, 23 Dec 2004 11:13:09 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Reinitializing Size of Anonymous Array
Message-Id: <231220041113095895%jgibson@mail.arc.nasa.gov>

In article <10ski0msvpn676c@corp.supernews.com>, BigDaDDY
<ihatespam@hotmail.com> wrote:

> How would I reinitialize the size of an anonymous array? For example:
> 
> 
> foreach $run (@runs){
> 
>    push (@{$table{$country}}), $city
> }
> 
> However, for each run, I want to clear the array.  I've seen the 
> $#array = -1 to clear a regular array, but not quite sure what to do hear.  
> Any help would be highly appreciated.  Thanks,

If $table{$country} is a reference to an anonymous array, replace the
current array with a new anonymous array:

   $table{$country} = [];

The old, non-empty anonymous array will be garbage-collected.

Or, as you suggest,

   $#{$table{$country}} = -1;

will also work.

Rember the rule: replace the name of a named array with an array
reference in braces for any array value.


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---


-----------== Posted via Newsfeed.Com - Uncensored Usenet News ==----------
   http://www.newsfeed.com       The #1 Newsgroup Service in the World!
-----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =-----


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

Date: Thu, 23 Dec 2004 12:55:45 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Saving regex to new variable
Message-Id: <slrncsm55h.1n0.tadmc@magna.augustmail.com>

Lance Hoffmeyer <lance-news@augustmail.com> wrote:

> I am trying to save a regex as a new variable "$month".


You are not trying to save a regex, you are trying to save the
characters *that are matched* by a regex.


> It is a regex that takes a date (2004-12-23) and saves
> only the month from this date. 

> ($month) => $row_ary[2] =~ s/([0-9]+)\-([0-9]+)\-([0-9]+)/$2/;


Use a m// in list context:

   my($month) = $row_ary[2] =~ /\d+-(\d+)-\d+/;  # untested


Hyphens are not special in regexes, there is no need to
backslash them. \d is an easier way to write [0-9].


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Thu, 23 Dec 2004 11:22:38 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Saving regex to new variable
Message-Id: <231220041122389999%jgibson@mail.arc.nasa.gov>

In article <pan.2004.12.23.18.18.35.872153@augustmail.com>, Lance
Hoffmeyer <lance-news@augustmail.com> wrote:

> Hello all,
> 
> Been a while since I have worked the perl in this manner.
> 
> I am trying to save a regex as a new variable "$month".
> It is a regex that takes a date (2004-12-23) and saves
> only the month from this date.  Can't seem to remember
> how to do this.  
> 
>  
> while (my @row_ary  = $sth->fetchrow_array)
>     {
> 
> ($month) => $row_ary[2] =~ s/([0-9]+)\-([0-9]+)\-([0-9]+)/$2/;
> print $month;

You don't want to save the regex, you want to save the month matched
within the regex, but only if it matches. Try this:

   if( $row_ary[2] =~ /\d+-(\d+)-\d+/ ) {
      $month = $1;
   }

Dashes are not special within double quotes and need not be excaped. \d
is short for [0-9]. You need only one set of parentheses to capture a
single datum.


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---


-----------== Posted via Newsfeed.Com - Uncensored Usenet News ==----------
   http://www.newsfeed.com       The #1 Newsgroup Service in the World!
-----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =-----


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

Date: Thu, 23 Dec 2004 13:26:42 -0600
From: Lance Hoffmeyer <lance-news@augustmail.com>
Subject: Use of uninitialized value in split ?
Message-Id: <pan.2004.12.23.19.26.41.954153@augustmail.com>

I keep getting 

Use of uninitialized value in split at ./birthday.pl line 33.
Use of uninitialized value in split at ./birthday.pl line 33.

on some of the lines of my WHILE loop.   Some of the other
lines of the WHILE loop work fine.


When running the script below.  I did a check outside of the 
WHILE loop to see if the problem would still exist.  It does
not.




#!/usr/bin/perl -w
use Pg;
use DBI;
use Date::Manip;



# Check to see if this happens outside DB loop
($year, $month, $week, $day)  = split(/:/,"-0:4:3:2:0:0:0",4);
print "$year $month $week \n";



$dbh = DBI->connect ( "dbi:Pg:dbname=foobar", "foobar",
"foobar"); if ($dbh) {
   print "connected\n";

my $Command = "SELECT first_name, last_name, birthday FROM gw_contact_person";

my $sth = $dbh->prepare($Command);
my $Result = $sth->execute;

$today = &UnixDate("today","%Y-%m-%d");
$date1 = ParseDate($today);

while (my @row_ary  = $sth->fetchrow_array)
    {


$date2 = ParseDate($row_ary[2]);
$date2 =~ s/^[0-9]{4}/2004/;
$flag = DateCalc($date1,$date2,1);
#    => YY:MM:WK:DD:HH:MM:SS

($year, $month, $week, $day)  = split(/:/,$flag,4);


if ($row_ary[2] ne ""){printf "%35s %25s %15s %15s %15s %15s %5s  \n",
$row_ary[0], $row_ary[1], $row_ary[2],$date1, $date2, $flag, $year

    }



   $sth->finish;
   $dbh->disconnect();
} else {
   print "Cannot connect to Postgres server: $DBI::errstr\n";
   print " db connection failed\n";
}




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

Date: Thu, 23 Dec 2004 21:53:06 +0100
From: Matija Papec <perl@my-header.org>
Subject: Re: Use of uninitialized value in split ?
Message-Id: <rubms0h488h2q99rvjcomsa0r567c312oo@4ax.com>

X-Ftn-To: Lance Hoffmeyer 

Lance Hoffmeyer <lance-news@augustmail.com> wrote:
>Use of uninitialized value in split at ./birthday.pl line 33.
>Use of uninitialized value in split at ./birthday.pl line 33.
>
>on some of the lines of my WHILE loop.   Some of the other
>lines of the WHILE loop work fine.
>
>
>When running the script below.  I did a check outside of the 
>WHILE loop to see if the problem would still exist.  It does
>not.
>
>
>#!/usr/bin/perl -w

"use strict" can be also helpful
>use Pg;
>use DBI;
>use Date::Manip;

>($year, $month, $week, $day)  = split(/:/,$flag,4);

I guess you're splitting undef and thus the warning.



-- 
Matija


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

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 V10 Issue 7563
***************************************


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