[16778] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4190 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 31 14:05:40 2000

Date: Thu, 31 Aug 2000 11:05:20 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <967745119-v9-i4190@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 31 Aug 2000     Volume: 9 Number: 4190

Today's topics:
    Re: "Premature end of script headers" <jgoldst@my-deja.com>
    Re: "Premature end of script headers" paceman97@aol.com
    Re: About reading the chinese file. <bart.lateur@skynet.be>
        Bug in perl 5.005_03 or 5.003_01? ("my" and loops) <heiter@astro.univie.ac.at>
        Bug in perl 5.005_03 or 5.003_01? ("my" and loops) <heiter@astro.univie.ac.at>
        Bug in perl 5.005_03 or 5.003_01? ("my" and loops) <heiter@astro.univie.ac.at>
        Bug in perl 5.005_03 or 5.003_01? ("my" and loops) <heiter@astro.univie.ac.at>
        Bug in perl 5.005_03 or 5.003_01? ("my" and loops) <heiter@astro.univie.ac.at>
        Bug in perl 5.005_03 or 5.003_01? ("my" and loops) <heiter@astro.univie.ac.at>
        Bug in perl 5.005_03 or 5.003_01? ("my" and loops) <heiter@astro.univie.ac.at>
        Bug in perl 5.005_03 or 5.003_01? ("my" and loops) <heiter@astro.univie.ac.at>
        Bug in perl 5.005_03 or 5.003_01? ("my" and loops) <heiter@astro.univie.ac.at>
    Re: Bug in perl 5.005_03 or 5.003_01? ("my" and loops) <heiter@astro.univie.ac.at>
    Re: Bug in perl 5.005_03 or 5.003_01? ("my" and loops) nobull@mail.com
    Re: Bug in Perl regular expressions? (Decklin Foster)
    Re: Bulk add to a hash.. Thanks for the help! (brian d foy)
        Chat with stream (Heikki Simperi)
    Re: Connect to HP3000 using PERL ??? <lappel@grc.hp.com>
    Re: File handles with scalar value (Anno Siegel)
        FTP through Firewall???? <emuldown@bellsouth.net>
    Re: How are hashes stored internally? <lauren_smith13@hotmail.com>
    Re: How are hashes stored internally? <tim@ipac.caltech.edu>
        How do I read a text file line-by-line ..... <MPEDDLE@uk.ibm.com>
    Re: How do I read a text file line-by-line ..... nobull@mail.com
    Re: How do I read a text file line-by-line ..... <rmore1@my-deja.com>
    Re: How to launch a windows application from my script? <bart.lateur@skynet.be>
    Re: How to read a dir with recursive directories? <thomas2@dalnet.se>
    Re: Jumping to the previous row with DBI reschramz@my-deja.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 31 Aug 2000 16:07:04 GMT
From: JL Goldstein <jgoldst@my-deja.com>
Subject: Re: "Premature end of script headers"
Message-Id: <8olvqm$opt$1@nnrp1.deja.com>

In article <slrn8qspm0.ucf.mgjv@martien.heliotrope.home>,
  mgjv@tradingpost.com.au wrote:

> Not a Perl error. All Perl errors should be documented in the perldiag
> documentation, which you can read by typing something like
>
> # perldoc perldiag

Aha. I did find it there, under "Server error." Sure enough, it's "a CGI
error, not a Perl error." <banging head against wall>

Thank you for your kind and patient reply. :-)


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 31 Aug 2000 13:33:03 -0400
From: paceman97@aol.com
Subject: Re: "Premature end of script headers"
Message-Id: <39AE96CE.C42663A@aol.com>

try to put
exit;
at the end of the script


JL Goldstein wrote:

> There must be some documentation of this error somewhere, so I'm
> probably going to get flamed for asking this question, but since I don't
> know where to find the answer I'm going to risk it.
>
> I've got a Perl CGI script that works just fine. However, I check the
> server's error log every so often just for chuckles, and I found a
> "Premature end of script headers" warning for this script. What does
> this apparently non-fatal error mean?
>
> --
> ----
> Any sufficiently advanced magic is indistinguishable from Perl.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.



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

Date: Thu, 31 Aug 2000 17:22:21 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: About reading the chinese file.
Message-Id: <rc4tqsojchj6nk45m9tm8fnic9jq9fd08v@4ax.com>

Tom wrote:

>I wrote a perl program which is read a chinese character file, then
>redirect the output for the web page.
>But when on the web page, it will show the ÁÙ¤£«Hªº¸Ü,ºô¥D·|© code,
>Does anyone know how to solve this problems?

You need to provide an appropriate content-type header. Either that, or
include a proper META - HTTP-EQUIV tag inside the HTML file. For
ISO-Latin-1, this tag takes the form:

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
	
For Chinese, you'll have to replace the charset accordingly. You'll
probably have to experiment until you find the correct name to fill in.

I've done a quick web search, and this is what I came up with long live
Google!)

	<http://www.w3.org/TR/REC-html40/charset.html>

In principle, this charset specification may alternatively be included
in the content-type header. I think that in CGI.pm (I'm not a CGI.pm
user myself, but the docs seem to suggest it), this should work:

	print header('text/html; charset=...');

with the dots replaced by the name of your encoding.

Good luck.

-- 
	Bart.


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

Date: Thu, 31 Aug 2000 17:51:11 +0100
From: Heiter <heiter@astro.univie.ac.at>
Subject: Bug in perl 5.005_03 or 5.003_01? ("my" and loops)
Message-Id: <39AE8CFF.C4E5B213@astro.univie.ac.at>

Hi,

Recently I found a part of code in a perl script, which
behaved differently under two versions of perl.
Consequently, there must be a bug in one of the versions,
but I don't know which one behaves correctly.

Here is a simple test code:

my @test_array = (1,2,3,4,5,6);
foreach (@test_array) {
   print shift(@test_array)."\n";
}

The output was
under perl, version 5.003_01 (+ suidperl security patch), 
installed on a dec unix alpha workstation:
1
2
3
4
5
6

under perl, version 5.005_03 built for alpha-linux
(Redhat 2.2.14):
1
2
3

That means: in the first version, the array used by foreach was 
not changed by the shift call, and in the second version it was
changed during the loop, so that it ended after half of the
elements.

Which one is right?

Notes:
1) If "my" is omitted in the first line, the output is the same
under
both versions.

2) In the case of the particular script I found this construct, 
it is not necessary and can be better written like this:

my @test_array = (1,2,3,4,5,6);
# or the same without "my"
foreach (@test_array) {
   print $_."\n";
}

Ulli


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

Date: Thu, 31 Aug 2000 17:56:02 +0100
From: Heiter <heiter@astro.univie.ac.at>
Subject: Bug in perl 5.005_03 or 5.003_01? ("my" and loops)
Message-Id: <39AE8E22.55E1D30F@astro.univie.ac.at>

Hi,

Recently I found a part of code in a perl script, which
behaved differently under two versions of perl.
Consequently, there must be a bug in one of the versions,
but I don't know which one behaves correctly.

Here is a simple test code:

my @test_array = (1,2,3,4,5,6);
foreach (@test_array) {
   print shift(@test_array)."\n";
}

The output was
under perl, version 5.003_01 (+ suidperl security patch), 
installed on a dec unix alpha workstation:
1
2
3
4
5
6

under perl, version 5.005_03 built for alpha-linux
(Redhat 2.2.14):
1
2
3

That means: in the first version, the array used by foreach was 
not changed by the shift call, and in the second version it was
changed during the loop, so that it ended after half of the
elements.

Which one is right?

Notes:
1) If "my" is omitted in the first line, the output is the same
under
both versions.

2) In the case of the particular script I found this construct, 
it is not necessary and can be better written like this:

my @test_array = (1,2,3,4,5,6);
# or the same without "my"
foreach (@test_array) {
   print $_."\n";
}

Ulli


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

Date: Thu, 31 Aug 2000 17:56:52 +0100
From: Heiter <heiter@astro.univie.ac.at>
Subject: Bug in perl 5.005_03 or 5.003_01? ("my" and loops)
Message-Id: <39AE8E54.4815D4D6@astro.univie.ac.at>

Hi,

Recently I found a part of code in a perl script, which
behaved differently under two versions of perl.
Consequently, there must be a bug in one of the versions,
but I don't know which one behaves correctly.

Here is a simple test code:

my @test_array = (1,2,3,4,5,6);
foreach (@test_array) {
   print shift(@test_array)."\n";
}

The output was
under perl, version 5.003_01 (+ suidperl security patch), 
installed on a dec unix alpha workstation:
1
2
3
4
5
6

under perl, version 5.005_03 built for alpha-linux
(Redhat 2.2.14):
1
2
3

That means: in the first version, the array used by foreach was 
not changed by the shift call, and in the second version it was
changed during the loop, so that it ended after half of the
elements.

Which one is right?

Notes:
1) If "my" is omitted in the first line, the output is the same
under
both versions.

2) In the case of the particular script I found this construct, 
it is not necessary and can be better written like this:

my @test_array = (1,2,3,4,5,6);
# or the same without "my"
foreach (@test_array) {
   print $_."\n";
}

Ulli


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

Date: Thu, 31 Aug 2000 17:57:39 +0100
From: Heiter <heiter@astro.univie.ac.at>
Subject: Bug in perl 5.005_03 or 5.003_01? ("my" and loops)
Message-Id: <39AE8E83.E779354B@astro.univie.ac.at>

Hi,

Recently I found a part of code in a perl script, which
behaved differently under two versions of perl.
Consequently, there must be a bug in one of the versions,
but I don't know which one behaves correctly.

Here is a simple test code:

my @test_array = (1,2,3,4,5,6);
foreach (@test_array) {
   print shift(@test_array)."\n";
}

The output was
under perl, version 5.003_01 (+ suidperl security patch), 
installed on a dec unix alpha workstation:
1
2
3
4
5
6

under perl, version 5.005_03 built for alpha-linux
(Redhat 2.2.14):
1
2
3

That means: in the first version, the array used by foreach was 
not changed by the shift call, and in the second version it was
changed during the loop, so that it ended after half of the
elements.

Which one is right?

Notes:
1) If "my" is omitted in the first line, the output is the same
under
both versions.

2) In the case of the particular script I found this construct, 
it is not necessary and can be better written like this:

my @test_array = (1,2,3,4,5,6);
# or the same without "my"
foreach (@test_array) {
   print $_."\n";
}

Ulli


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

Date: Thu, 31 Aug 2000 18:03:47 +0100
From: Heiter <heiter@astro.univie.ac.at>
Subject: Bug in perl 5.005_03 or 5.003_01? ("my" and loops)
Message-Id: <39AE8FF3.E4EA3CDE@astro.univie.ac.at>

Hi,

Recently I found a part of code in a perl script, which
behaved differently under two versions of perl.
Consequently, there must be a bug in one of the versions,
but I don't know which one behaves correctly.

Here is a simple test code:

my @test_array = (1,2,3,4,5,6);
foreach (@test_array) {
   print shift(@test_array)."\n";
}

The output was
under perl, version 5.003_01 (+ suidperl security patch), 
installed on a dec unix alpha workstation:
1
2
3
4
5
6

under perl, version 5.005_03 built for alpha-linux
(Redhat 2.2.14):
1
2
3

That means: in the first version, the array used by foreach was 
not changed by the shift call, and in the second version it was
changed during the loop, so that it ended after half of the
elements.

Which one is right?

Notes:
1) If "my" is omitted in the first line, the output is the same
under
both versions.

2) In the case of the particular script I found this construct, 
it is not necessary and can be better written like this:

my @test_array = (1,2,3,4,5,6);
# or the same without "my"
foreach (@test_array) {
   print $_."\n";
}

Ulli


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

Date: Thu, 31 Aug 2000 18:04:46 +0100
From: Heiter <heiter@astro.univie.ac.at>
Subject: Bug in perl 5.005_03 or 5.003_01? ("my" and loops)
Message-Id: <39AE902E.35AA490C@astro.univie.ac.at>

Hi,

Recently I found a part of code in a perl script, which
behaved differently under two versions of perl.
Consequently, there must be a bug in one of the versions,
but I don't know which one behaves correctly.

Here is a simple test code:

my @test_array = (1,2,3,4,5,6);
foreach (@test_array) {
   print shift(@test_array)."\n";
}

The output was
under perl, version 5.003_01 (+ suidperl security patch), 
installed on a dec unix alpha workstation:
1
2
3
4
5
6

under perl, version 5.005_03 built for alpha-linux
(Redhat 2.2.14):
1
2
3

That means: in the first version, the array used by foreach was 
not changed by the shift call, and in the second version it was
changed during the loop, so that it ended after half of the
elements.

Which one is right?

Notes:
1) If "my" is omitted in the first line, the output is the same
under
both versions.

2) In the case of the particular script I found this construct, 
it is not necessary and can be better written like this:

my @test_array = (1,2,3,4,5,6);
# or the same without "my"
foreach (@test_array) {
   print $_."\n";
}

Ulli


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

Date: Thu, 31 Aug 2000 18:06:50 +0100
From: Heiter <heiter@astro.univie.ac.at>
Subject: Bug in perl 5.005_03 or 5.003_01? ("my" and loops)
Message-Id: <39AE90AA.36C24A1F@astro.univie.ac.at>

Hi,

Recently I found a part of code in a perl script, which
behaved differently under two versions of perl.
Consequently, there must be a bug in one of the versions,
but I don't know which one behaves correctly.

Here is a simple test code:

my @test_array = (1,2,3,4,5,6);
foreach (@test_array) {
   print shift(@test_array)."\n";
}

The output was
under perl, version 5.003_01 (+ suidperl security patch), 
installed on a dec unix alpha workstation:
1
2
3
4
5
6

under perl, version 5.005_03 built for alpha-linux
(Redhat 2.2.14):
1
2
3

That means: in the first version, the array used by foreach was 
not changed by the shift call, and in the second version it was
changed during the loop, so that it ended after half of the
elements.

Which one is right?

Notes:
1) If "my" is omitted in the first line, the output is the same
under
both versions.

2) In the case of the particular script I found this construct, 
it is not necessary and can be better written like this:

my @test_array = (1,2,3,4,5,6);
# or the same without "my"
foreach (@test_array) {
   print $_."\n";
}

Ulli


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

Date: Thu, 31 Aug 2000 18:07:37 +0100
From: Heiter <heiter@astro.univie.ac.at>
Subject: Bug in perl 5.005_03 or 5.003_01? ("my" and loops)
Message-Id: <39AE90D9.E34B10AB@astro.univie.ac.at>

Hi,

Recently I found a part of code in a perl script, which
behaved differently under two versions of perl.
Consequently, there must be a bug in one of the versions,
but I don't know which one behaves correctly.

Here is a simple test code:

my @test_array = (1,2,3,4,5,6);
foreach (@test_array) {
   print shift(@test_array)."\n";
}

The output was
under perl, version 5.003_01 (+ suidperl security patch), 
installed on a dec unix alpha workstation:
1
2
3
4
5
6

under perl, version 5.005_03 built for alpha-linux
(Redhat 2.2.14):
1
2
3

That means: in the first version, the array used by foreach was 
not changed by the shift call, and in the second version it was
changed during the loop, so that it ended after half of the
elements.

Which one is right?

Notes:
1) If "my" is omitted in the first line, the output is the same
under
both versions.

2) In the case of the particular script I found this construct, 
it is not necessary and can be better written like this:

my @test_array = (1,2,3,4,5,6);
# or the same without "my"
foreach (@test_array) {
   print $_."\n";
}

Ulli


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

Date: Thu, 31 Aug 2000 18:09:00 +0100
From: Heiter <heiter@astro.univie.ac.at>
Subject: Bug in perl 5.005_03 or 5.003_01? ("my" and loops)
Message-Id: <39AE912C.78B13FBE@astro.univie.ac.at>

Hi,

Recently I found a part of code in a perl script, which
behaved differently under two versions of perl.
Consequently, there must be a bug in one of the versions,
but I don't know which one behaves correctly.

Here is a simple test code:

my @test_array = (1,2,3,4,5,6);
foreach (@test_array) {
   print shift(@test_array)."\n";
}

The output was
under perl, version 5.003_01 (+ suidperl security patch), 
installed on a dec unix alpha workstation:
1
2
3
4
5
6

under perl, version 5.005_03 built for alpha-linux
(Redhat 2.2.14):
1
2
3

That means: in the first version, the array used by foreach was 
not changed by the shift call, and in the second version it was
changed during the loop, so that it ended after half of the
elements.

Which one is right?

Notes:
1) If "my" is omitted in the first line, the output is the same
under
both versions.

2) In the case of the particular script I found this construct, 
it is not necessary and can be better written like this:

my @test_array = (1,2,3,4,5,6);
# or the same without "my"
foreach (@test_array) {
   print $_."\n";
}

Ulli


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

Date: Thu, 31 Aug 2000 18:24:22 +0100
From: Heiter <heiter@astro.univie.ac.at>
Subject: Re: Bug in perl 5.005_03 or 5.003_01? ("my" and loops)
Message-Id: <39AE94C6.C1072639@astro.univie.ac.at>

Sorry, but Netscape Mail gave an error message concerning the
mail server and I thought the message had not been sent and
tried several times.

Ulli


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

Date: 31 Aug 2000 18:09:23 +0100
From: nobull@mail.com
Subject: Re: Bug in perl 5.005_03 or 5.003_01? ("my" and loops)
Message-Id: <u9r975we64.fsf@wcl-l.bham.ac.uk>

Heiter <heiter@astro.univie.ac.at> writes:

> Recently I found a part of code in a perl script, which
> behaved differently under two versions of perl.
> Consequently, there must be a bug in one of the versions,
> but I don't know which one behaves correctly.

Non-sequitur.  This only follows if the code in question has defined
semantics.

In the decription of foreach in perlsyn states: 

       If any part of LIST is an array, foreach will get very
       confused if you add or remove elements within the loop
       body, for example with splice.   So don't do that. 

IMHO "will get very confused" means that the semantics are undefined.
As such it is possible that _both_ behaviours are "correct" even
though they are different.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Thu, 31 Aug 2000 16:13:38 GMT
From: decklin+usenet@red-bean.com (Decklin Foster)
Subject: Re: Bug in Perl regular expressions?
Message-Id: <Suvr5.5971$CW2.66141@news1.rdc1.ct.home.com>

jba_lixx@my-deja.com <jba_lixx@my-deja.com> writes:

> ($scoretext=~ /^(\d+):(\d+)/) && ($score1= $1) && ($score2 = $2)

[OK, I see several responses, but all use a regex to find the numbers]

Overkill.

  ($score1, $score2) = split(/:/, $scoretext);

[There's still a regex in there, but it's not doing as much work.]

Keep in mind that you still have to make sure that $score1 and $score2
are defined; the split might not find what you want.

-- 
There is no TRUTH. There is no REALITY. There is no CONSISTENCY. There
are no ABSOLUTE STATEMENTS. I'm very probably wrong. -- BSD fortune(6)


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

Date: Thu, 31 Aug 2000 11:59:15 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Bulk add to a hash.. Thanks for the help!
Message-Id: <brian-ya02408000R3108001159150001@news.panix.com>

In article <8ol4jo$p2l$1@nnrp1.deja.com>, alphazerozero@my-deja.com posted:

>   brian@smithrenaud.com (brian d foy) wrote:
> > Perl has nothing to do with it.  it's a human issue.  the code
> > will be as readable as the programmer wants it to be no matter
> > what the language is.

> Well Im not so sure about that.  Some languages are more inclined
> towards legibility

that's a red herring. it's hard for me to beleive that some people
actually have that much faith in languages being used how their
designers thought they would be used.  i've spent too much time
(any time is too much ;) as a maintenance programmer to realize 
that even languages designed to be readable can be made unreadable
by the typical student.

furthermore, legibility is not the issue. it matters little if the
maintenance programmer can easily tell what the literal text says
(legibility).  they have to also be able to know what is happening
in the code.  legibility is not a sufficient condition for 
readability.

Perl can be as readable as the programmer wants their code to be
read.  Perl does not force the code to be unreadable or obfuscated.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>


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

Date: Thu, 31 Aug 2000 16:04:26 GMT
From: trio@surffi.net (Heikki Simperi)
Subject: Chat with stream
Message-Id: <39ae8202.21127725@news.saunalahti.fi>

Hi,

i am looking for tutorial, guide or ready scripts of streams like in
chat. I mean stream which keep connection to user and do it without
meta-refresh systems etc.

I don´t know is this the right group, so if it is could someone tell
me the right ones.


B.R.

Heikki Simperi
trio@surffi.net


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

Date: Thu, 31 Aug 2000 19:13:01 +0200
From: Lars Appel <lappel@grc.hp.com>
Subject: Re: Connect to HP3000 using PERL ???
Message-Id: <39AE921D.7A9887FE@grc.hp.com>

The freevt3k sources live at 
  http://www.anime.net/freevt3k/
as far as I recall.

Your Perl will surely not have any success to talk
to port 1537 as the listener on MPE/iX expects to
talk NS/3000 VT protocol, not telnet there.

I have used Java telnet classes to remotely control
MPE/iX applications from servlets, applets, as well
as programs, so it should work with Perl, too.

See a recent thread on HP3000-L in this regard, the
subject was something like "batch telnet" IIRC, which
discussed a related topic and also had some snippets
of code (if I recall correctly)...

A quick search at http://www.optc.com/Webbot/ for
example (threaded archive), gives hits like...

 http://www.optc.com/Webbot/Thread18232.html

Cheers, Lars.


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

Date: 31 Aug 2000 16:12:55 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: File handles with scalar value
Message-Id: <8om067$lf5$1@lublin.zrz.tu-berlin.de>
Keywords: Grenoble, eternity, kinglet, volatile

Mark-Jason Dominus <mjd@plover.com> wrote in comp.lang.perl.misc:
>In article <8ol7fj$ksb$1@lublin.zrz.tu-berlin.de>,
>Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>>Uh... is that how it is done?  
>
>The source code is on your disk.
>
>>In the open statement, Perl treats $filehandle_name as a symref, 
>
>In
>
>        open FOO, "..."
>
>perl *also* treats the filehandle name as a symref.  FOO is a literal
>string, which is interpreted symbolically as a reference to the glob *FOO.

Oh.  So open()s first argument is really a string and "open FOO..."
is the same thing as "open 'FOO'..." at the cost of a bareword.  The
filehandle in "<FOO>" however cannot be written "<'FOO'>", apparently
'FOO' isn't even parsed as expected.  Not to go into too much bizarre
detail here, but strange things happen when you try to give <> a
literal string.  It can even work[2].  Filehandles are a minefield.

However, in the "open FOO..." case, the implied symref is politely
ignored by strict[1], whereas in the "open $filename..." case it
is rejected.


[1] The use of FOO as a bareword isn't likewise ignored by -w.  Using
    foo instead gives you the well-known warning about reserved words.

[2] $fh = '\''; # a single apostrophe
    open $fh, 'some_file';
    print <''>; # .oO( what might Abigail do with a filehandle named '?)


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

Date: Thu, 31 Aug 2000 11:52:54 -0400
From: "EFM" <emuldown@bellsouth.net>
Subject: FTP through Firewall????
Message-Id: <39ae80b2_3@news1.prserv.net>

I'm trying to test connecting to an FTP server outside my companies
firewall.  We do't use SOCKS but need to implement user@hostname.  I'm
unfamiliar with this and need a sample script if anyone has one.




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

Date: Thu, 31 Aug 2000 10:29:16 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: How are hashes stored internally?
Message-Id: <8om4hm$gus$1@brokaw.wa.com>


Chris Barnabo <chris@spagnet.com> wrote in message
news:MPG.141794dcd9b5d2e59896ad@news.supernews.com...
> Just curious ... how does perl store hashes internally?  I've read perldoc
> perlguts and it indicates that the actual data nodes (perhaps not the
right
> term) are stored in linked lists, which makes sense for iterating over the
> hash elements, returning all values or keys, etc.  But it doesn't seem to
> discuss how the hash keys themselves are stored or searched - I would
guess
> that for efficiency there must be some sort of structure other than the
> linked lists that holds the keys so they can be quickly searched and
> inserted?
>
> Interested from a performance standpoint ... I just spent the morning
> writing code to build & search a balanced binary tree in another language
> and thought perl hashes would've been a neat solution to the problem if I
> could've used perl for that project.

Having a few hours to myself a couple nights ago, I thought it would be cool
to comb through the perl source.  It turns out that I was way over my head.
I've never seen the C preprocessor so abused.  :-)

In any case, I happened upon hv.c and hv.h which seem to be what you are
looking for.

Lauren
--
print grep ord $_,map{y/a-zA-Z//d;$x.="+ $_";chr(eval $x)}
'J74u43-s2tA1-84n33o45th1er5-12-P3e13-82r48l21H13-a6-76
c40k25er2wx8-y6z13-81'=~m#([^!\n]{3})#g#tr/-0-9//d;print




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

Date: Thu, 31 Aug 2000 10:54:37 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: How are hashes stored internally?
Message-Id: <39AE9BDD.F3EC0273@ipac.caltech.edu>

Chris Barnabo wrote:
> 
> Just curious ... how does perl store hashes internally?  I've read perldoc
> perlguts and it indicates that the actual data nodes (perhaps not the right
> term) are stored in linked lists, which makes sense for iterating over the
> hash elements, returning all values or keys, etc.  But it doesn't seem to
> discuss how the hash keys themselves are stored or searched - I would guess
> that for efficiency there must be some sort of structure other than the
> linked lists that holds the keys so they can be quickly searched and
> inserted?

Lookups are done by indexing on a suitably masked hash of the key into a table
of linked-list "buckets". I think you can find discussion of Larry's invention
of the cool details ... somewhere. Anyone have the URL handy?

--

-- Tim Conrow         tim@ipac.caltech.edu       626-395-8435


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

Date: Thu, 31 Aug 2000 16:29:12 GMT
From: Mark <MPEDDLE@uk.ibm.com>
Subject: How do I read a text file line-by-line .....
Message-Id: <sqt1uo54c5d48@corp.supernews.com>

I am attempting to read in a textfile, manipulate it, and output the 
results to another textfile.
This is usually straightforward.....

The problem i have is that the input file i am manipulating contains 
characters that look like an end of file, but infact are not. 

Does anyone know of a way to read in a file, and then process it line by 
line, ignoring these bogus "end of file" markers.

All the examples i find use 
while (<SOURCEFILE>) { some code or other }

which is no good as the loop automatically terminates when it reaches the 
dodgy characters. I am sure there is another way to do this - anybody have 
any ideas ?

Mark.

--
Posted via CNET Help.com
http://www.help.com/


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

Date: 31 Aug 2000 17:49:47 +0100
From: nobull@mail.com
Subject: Re: How do I read a text file line-by-line .....
Message-Id: <u9wvgxwf2s.fsf@wcl-l.bham.ac.uk>

Mark <MPEDDLE@uk.ibm.com> writes:

> The problem i have is that the input file i am manipulating contains 
> characters that look like an end of file, but infact are not. 

In binmode() there's no such thing as an end of file marker.

Using binmode() you have to be explicitly aware of the ^M characters
in more contexts.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Thu, 31 Aug 2000 17:35:02 GMT
From: Rich More <rmore1@my-deja.com>
Subject: Re: How do I read a text file line-by-line .....
Message-Id: <8om505$vc9$1@nnrp1.deja.com>

In article <sqt1uo54c5d48@corp.supernews.com>,
  Mark <MPEDDLE@uk.ibm.com> wrote:
> I am attempting to read in a textfile, manipulate it, and output the
> results to another textfile.
> This is usually straightforward.....
>
> The problem i have is that the input file i am manipulating contains
> characters that look like an end of file, but infact are not.
>
> Does anyone know of a way to read in a file, and then process it line
by
> line, ignoring these bogus "end of file" markers.
>
> All the examples i find use
> while (<SOURCEFILE>) { some code or other }
>
> which is no good as the loop automatically terminates when it reaches
the
> dodgy characters. I am sure there is another way to do this - anybody
have
> any ideas ?

Try sysread??

From perldoc -f sysread

There is no syseof() function, which is ok, since eof() doesn't work
very well on device files (like ttys) anyway.  Use sysread() and check
for a return value for 0 to decide whether you're done.
--
=============================
Richard More
http://www.richmore.com/


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 31 Aug 2000 15:28:10 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: How to launch a windows application from my script?
Message-Id: <rbusqs8r41kcauu9vvhsqangeolkvv4tcq@4ax.com>

JakeRocket wrote:

>I am writing to an Output file that I want to launch in Windows
>Notepad as soon as my script is done.  Does perl support this, and if
>so how?

	system()

Don't forget to close your file before you dod this, or Notepad will get
an incomplete file.

-- 
	Bart.


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

Date: Thu, 31 Aug 2000 15:05:05 GMT
From: "Thomas Åhlen" <thomas2@dalnet.se>
Subject: Re: How to read a dir with recursive directories?
Message-Id: <Buur5.81$pz5.53289@news.bahnhof.se>

You could try somthing like this:

===============

use File::Find ();

# some code here

sub find(&@) { &File::Find::find }
find { push @{$array}, $File::Find::name if -d } $path;

===============

This will give you an array with all directories under the given path.

Thomas Åhlen

>Rodrigo Cortés skrev i meddelandet <5Mlr5.8365$gi.115631@maule>...
>What is the faster way to do this and list the archives?
>
>--
>==============================
>Rodrigo Cortés
>Roco3D
>ICQ:35921840
>roco3d@pmail.net
>http://roco3d.virtualave.net
>==============================
>
>




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

Date: Thu, 31 Aug 2000 17:22:20 GMT
From: reschramz@my-deja.com
Subject: Re: Jumping to the previous row with DBI
Message-Id: <8om47i$uhv$1@nnrp1.deja.com>

In article <slrn8qsokm.ucf.mgjv@martien.heliotrope.home>,
  mgjv@tradingpost.com.au wrote:
> On Wed, 30 Aug 2000 15:11:52 +0200,
> 	Hans Eriksson <Hans.X.Eriksson@etx.ericsson.se> wrote:
> > Hello!
> >
> > Does anyone know if it is possible to go to the prevoius row when
using
> > the Perl DBI interface? I.e. -- Is it possible to "go back" when a
> > $sth->fetchrow has been issued?
>
> Unless you cache them yourself, I doubt very much it's possible. I've
> never seen anything that would do the job. I've never seen anything
like
> that in any other database drivers (that I've worked with) either.
I've
> never needed it. I think you probably will have to cache the stuff
> yourself and use that.
>
> Martien

Hey come on! We can get creative about this. We just need to know what
kind of data is being delivered by the fetchrow_array(). Is there so
much that you would not want to use fetchrow_arrayref(), and traverse
back and forth yourself?

It might also be helpful to know what the relationship between the rows
is. If you hit upon something in one row, why would you need to "go
back" to the row before? What's the connection between a row that meets
a criteria, and one that doesn't but precedes a match?

Also, consider looking to the alternative (yet, off-topic) approaches
to SQL queries. What specific SQL server are you using? Can you create
a table and create relationships between the first and the second table?


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 4190
**************************************


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