[9204] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2799 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 6 09:08:06 1998

Date: Sat, 6 Jun 98 06:01:16 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 6 Jun 1998     Volume: 8 Number: 2799

Today's topics:
    Re: -d ? 3 : 7 is ambiguous, how comes? (Larry Rosler)
        [EUREKA] Yes, I think it is (was Re: No, It's Not (was  <Russell_Schulz@locutus.ofB.ORG>
    Re: Clearing arrays and hashes <bowlin@sirius.com>
    Re: Clearing arrays and hashes <bowlin@sirius.com>
        delete slice in list <xah@shell13.ba.best.com>
        Downloading Perl (Rainer Pielmann)
    Re: Downloading Perl (Jonathan Stowe)
        File processor and conditional output (Erik Huelsmann)
    Re: Generate unique id <stylinsty@yahoo.com>
        help cgi guestbook <godfrey@unixg.ubc.ca>
    Re: Help!!!! "ccperl -e" behaves differently under UNIX (Larry Rosler)
    Re: How do I get text counter perl script to work??? (Andre L.)
        How to make a list of combinations? mccaskey@my-dejanews.com
    Re: I'm having problems: <dafydd@jps.net>
    Re: I'm having problems: (John O Comeau)
    Re: Lotus Notes from perl? <agruskin@melbpc.org.au>
        Newbie: sorting of flat files .... <joe@halbrook.com>
    Re: Newbie: sorting of flat files .... <ebohlman@netcom.com>
        Novell Web Server, PERL, and base64 encoding <gdoucet@ait.acl.ca>
    Re: Novell Web Server, PERL, and base64 encoding (Bob Trieger)
        Perl - Newsgroup poster script? luckycom@ica.net
    Re: Perl - Newsgroup poster script? (Jonathan Stowe)
        Perl 5.004_04 Won't compile on SCO Openserver 5 <jcokos@ccs.net>
    Re: perl equivalent to C's local static var? (Larry Rosler)
        Problem with Win32 <kisaac@enterprise.net>
        Q: drop a 'slice' in list <xah@shell13.ba.best.com>
        Reading a file from the bottom up <tan@jettech.dircon.co.uk>
    Re: Reading a PDF file with Perl (Jonathan Stowe)
        Stupid syntax question <betabeta@geocities.com>
    Re: Stupid syntax question (Jonathan Stowe)
        Uploading mirror <joe@ispsoft.de>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 5 Jun 1998 23:02:37 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: -d ? 3 : 7 is ambiguous, how comes?
Message-Id: <MPG.fe27b5561cfe4f989689@hplntx.hpl.hp.com>

In article <6l8lo6$7q2$1@lyra.csx.cam.ac.uk>, mjtg@cus.cam.ac.uk says...
> Larry Rosler <lr@hpl.hp.com> wrote:
 ...
> >                                And you would probably be wise to type 
> >'perl -ew' instead of 'perl -e' in any case.
> 
> Only if you really wanted to execute the script 'w'.    Try 'perl -we'
> instead.
 ...

perl -ew 'print "hi\n"'

works just fine for me.  Does it fail for you?  The order of agglomerated 
options is irrelevant.

To get the behavior you expect, one would have to write

perl -e w ...

with the space.

-- 
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com


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

Date: Sat, 6 Jun 1998 03:49:59 +0100
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: [EUREKA] Yes, I think it is (was Re: No, It's Not (was Re: Yes, it is))
Message-Id: <19980606.034959.1K5.rnr.w164w_-_@locutus.ofB.ORG>

I wonder if the original `Yes it is' was misposted in response to the
`Is perl case-sensitive' question.

in which case `No, It's Not' is wrong.
-- 
Russell_Schulz@locutus.ofB.ORG  Shad 86c


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

Date: Fri, 05 Jun 1998 22:20:44 -0700
From: Jim Bowlin <bowlin@sirius.com>
To: David Thornley <thornley@visi.com>
Subject: Re: Clearing arrays and hashes
Message-Id: <3578D1AC.B966F873@sirius.com>

David Thornley wrote:
> 

> [helpful discusion of the problem snipped]
> The approach I thought of is to clear out the values in the arrays
> and hash whenever I encounter a new object, but that doesn't seem
> to be working for the hash in particular.  I can't use "my", as far
> as I see, since I'd have to use it in a block referred to in an "if"
> statement, limiting the scope of those variables to that block.
> I tried using "undef", but I got complaints about undefined arrays
> (besides, I'm using "use strict" as well as "-w", and "use strict"
> requires every variable to be specified in a "my" statement or
> some other package-designating thing).

The problem is that you are always pushing the same arrays and hash.
If you print "@charac" for example, it will show you that you have pushed
the same reference over and over. (I think you already knew this).

The answer is to use references for your two arrays and one hash from the get-go.
They should be scalar variables pointing to anonymous arrays and hashes.
Try these changes:

>       push(@charac, [@characteristics]);
>       push(@attribute, [%attvalues]);
>       push(@attname, [@attnamelist]);

        push(@charac, $characteristics);
        push(@attribute, $attvalues);
        push(@attname, $attnamelist);

>         print "$line2:\n@characteristics\n@attnamelist\n";
          print "$line2:\n@{$characteristics}\n@{$attnamelist}\n";

>     @characteristics = ();
>     %attvalues = ();
>     @attnamelist = ();

      $characteristics = [];  # these three lines create NEW references
      $attvalues = {};        
      $attnamelist = [];

>     print "$line2:\n@characteristics\n@attnamelist\n";
      print "$line2:\n@{$characteristics}\n@{$attnamelist}\n";

>     $characteristics[$line1] = $line2;
      $$characteristics[$line1] = $line2;

>     $attvalues{$line2} = $line4;
>     push(@attnamelist, $line1);
      $$attvalues{$line2} = $line4;
      push(@$attnamelist, $line1);

I may have missed a couple, but you should get the general idea.  If you 
"use strict;" up at the top of your code, debugging this stuff is pretty 
easy.  You are also now free to declare 

my ($characteristics, $attvalues, $attnamelist);"  

either right before or right after the top while() statement.

HTH -- Jim Bowlin


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

Date: Fri, 05 Jun 1998 22:20:59 -0700
From: Jim Bowlin <bowlin@sirius.com>
To: David Thornley <thornley@visi.com>
Subject: Re: Clearing arrays and hashes
Message-Id: <3578D1BB.F5F66E86@sirius.com>

David Thornley wrote:
> 

> [helpful discusion of the problem snipped]
> The approach I thought of is to clear out the values in the arrays
> and hash whenever I encounter a new object, but that doesn't seem
> to be working for the hash in particular.  I can't use "my", as far
> as I see, since I'd have to use it in a block referred to in an "if"
> statement, limiting the scope of those variables to that block.
> I tried using "undef", but I got complaints about undefined arrays
> (besides, I'm using "use strict" as well as "-w", and "use strict"
> requires every variable to be specified in a "my" statement or
> some other package-designating thing).

The problem is that you are always pushing the same arrays and hash.
If you print "@charac" for example, it will show you that you have pushed
the same reference over and over. (I think you already knew this).

The answer is to use references for your two arrays and one hash from the get-go.
They should be scalar variables pointing to anonymous arrays and hashes.
Try these changes:

>       push(@charac, [@characteristics]);
>       push(@attribute, [%attvalues]);
>       push(@attname, [@attnamelist]);

        push(@charac, $characteristics);
        push(@attribute, $attvalues);
        push(@attname, $attnamelist);

>         print "$line2:\n@characteristics\n@attnamelist\n";
          print "$line2:\n@{$characteristics}\n@{$attnamelist}\n";

>     @characteristics = ();
>     %attvalues = ();
>     @attnamelist = ();

      $characteristics = [];  # these three lines create NEW references
      $attvalues = {};        
      $attnamelist = [];

>     print "$line2:\n@characteristics\n@attnamelist\n";
      print "$line2:\n@{$characteristics}\n@{$attnamelist}\n";

>     $characteristics[$line1] = $line2;
      $$characteristics[$line1] = $line2;

>     $attvalues{$line2} = $line4;
>     push(@attnamelist, $line1);
      $$attvalues{$line2} = $line4;
      push(@$attnamelist, $line1);

I may have missed a couple, but you should get the general idea.  If you 
"use strict;" up at the top of your code, debugging this stuff is pretty 
easy.  You are also now free to declare 

my ($characteristics, $attvalues, $attnamelist);"  

either right before or right after the top while() statement.

HTH -- Jim Bowlin


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

Date: 06 Jun 1998 04:37:01 -0700
From: Xah Lee <xah@shell13.ba.best.com>
Subject: delete slice in list
Message-Id: <yo3af7qvk0y.fsf@shell13.ba.best.com>



How can I
 delete a sequence of elements of a **LIST** in one line? (one semicolone)
To 
illustrate, the following drop the last 3 elements using two lines.

my @aa = split(m( ),'Dvorak keyboard is wonderful. Eh eh eh?');
my @result = @aa[0 .. $#aa-3];

where I wished something like

my @result =
 ... split(m( ),'Dvorak keyboard is wonderful. Eh eh eh?') ...;

Thanks.

 Xah, xah@best.com
 http://www.best.com/~xah/SpecialPlaneCurves_dir/specialPlaneCurves.html
 Q: is there a language that's completely ideom/sugar-syntax free?



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

Date: 6 Jun 1998 10:53:06 GMT
From: pira0011@rz03.FH-Karlsruhe.DE (Rainer Pielmann)
Subject: Downloading Perl
Message-Id: <6lb72i$mto$2@nz12.rz.uni-karlsruhe.de>

Hello,

I am new to Perl. Can anyone tell me where I can download a full
operational Perl version for a Windows 95 system?

Thx

Rainer


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

Date: Sat, 06 Jun 1998 12:15:50 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Downloading Perl
Message-Id: <35792b23.52958630@news.btinternet.com>

On 6 Jun 1998 10:53:06 GMT, Rainer Pielmann wrote :

>Hello,
>
>I am new to Perl. Can anyone tell me where I can download a full
>operational Perl version for a Windows 95 system?
>

Of course it all depends on what you mean by "a full operational Perl
version"  Perl on Win32 has limitations that are largely due to the
nature of the underlying OS,  Perl on Win95 has further limitations
compared with NT due to its own shortcomings .

You might start by looking at:

http://www.perl.com/latest.html

it might serve you well also if you check out:

http://language.perl.com/faq/index.html

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: 6 Jun 1998 12:10:42 GMT
From: ErikH@Bitsmart.com (Erik Huelsmann)
Subject: File processor and conditional output
Message-Id: <wzgSQd1pdrdd-pn2-gQOnrvVjG8d4@localhost>


I am looking for a textfile processor like a C preprocessor, to allow 
for conditional output. Since I am absolutely new to perl... Can it be
done easily in perl (or maybe: has it been done already)?

Any pointers on where to start would be greatly appreciated.

bye, Erik

--
Want to link your Psion to OS/2? Check out
http://www.BitSmart.com/ErikH/PSI.html


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

Date: Fri, 05 Jun 1998 12:16:34 -0700
From: Stylin <stylinsty@yahoo.com>
Subject: Re: Generate unique id
Message-Id: <35784412.37AF02EA@yahoo.com>

Thanks!

I'm going to use a counter and a sequence of random numbers.
Kinda like 3 but the process ID is a count.


Martien Verbruggen wrote:

> create a key
> check if the key already exists
> repeat until it doesn't.
>
> Another one, which is lots better: (2)
>
> All keys are monotonically increasing integers
> Start with key 1
> For every new process, create a key which is 1 higher than the last one
>
> > Something based on milliseconds since the beginning of mankind would be
> > cool.
>
> That is not unique. Two programs might run at exactly the same time,
> no matter what time resolution you use. A combination of time (seconds
> would most likely be enough) and process id might be a good one (3). Of
> course, if your system is really really fast, and rotates through all
> available process ids within one second, you're out of luck.
> Practically that won't happen for a few years.
>
> It's hard to tell you which one is best without knowing what sort of
> application you're writing, and what sort of shared data multiple
> instances of this application have. Probably (3) will do well for
> processes that have no shared data, (2) is much better if your
> processes do share data.



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

Date: Fri, 05 Jun 1998 20:17:25 -0700
From: Godfrey Hobbs <godfrey@unixg.ubc.ca>
Subject: help cgi guestbook
Message-Id: <3578B4C4.455CC6BE@unixg.ubc.ca>

Hi there folks.,

I got a start writing a guest book using perl/cgi.  You can see mine
below.

I am interserted in creating one that looks good and is exteremly
secure.  If you have any Ideas on
the following please responed


     doubley linked list?

I want the units of the list structure to be a paragraph (the message)
in a text file.  That is each
paragraph in a text file will be linked together with links to a parent
and child paragraphs.
Do I need a data base to do this??


     Hashing the message ID.

 I want to print with in the html code a message id.  So the message ID
will be visible to in the html
source yet hidden in the formated page.  I want to be able to encode the
message ID's so I can use
the info in a <INPUT=hidden > tag.  But I don't want anyoneone else
having access to message ID
for security reasons.  (I'm not talking 64 bit encryption, just a simple
hash function)  Any ideas??


 my no brainer guest book
http://www.csss.cs.ubc.ca/~godfrey/testform.html



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

Date: Fri, 5 Jun 1998 23:12:00 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Help!!!! "ccperl -e" behaves differently under UNIX and Windows 95
Message-Id: <MPG.fe27d8b12c5eb0798968a@hplntx.hpl.hp.com>

[This followup was posted to comp.lang.perl.misc and a copy was sent to 
the cited author.]

In article <3577E850.A724DB26@daytonoh.ncr.com>, 
ping.cui@daytonoh.ncr.com says...
> Thanks for everyone. I was writing a cross platform trigger for a tool so that the
> trigger could
> correctly fire under both UNIX and Windows environment. Replacing Windows command
> interpreter is not my option. Looks like I am running into a wall. Thanks for help
> any way.
> 
> Ping

Why are you giving up?  I have already seen one post that tells you how 
to solve this problem without replacing the Windows command interpreter:

Outer quotes for the script:  double-quotes
Inner quotes within the script: q{} or qq{} or any variations thereof.

Should work with COMMAND.EXE or CMD.EXE or with a real shell on Windows 
or Unix.

 ...

-- 
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com


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

Date: Fri, 05 Jun 1998 15:15:22 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: How do I get text counter perl script to work???
Message-Id: <alecler-0506981515220001@dialup-508.hip.cam.org>

In article <3577D2DA.3C4F93E@nortel.co.uk>, "F.Quednau"
<quednauf@nortel.co.uk> wrote:

[...]

> > <!--exec cgi="/counter.pl"-->
> 
> This is in comments?!? 

<CLUE>Yes, it's called a "server-side include" (well, almost, there's a #
missing and the path is all wrong).</CLUE>

A.L.


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

Date: Sat, 06 Jun 1998 03:43:21 GMT
From: mccaskey@my-dejanews.com
Subject: How to make a list of combinations?
Message-Id: <6ladsp$plq$1@nnrp1.dejanews.com>

Given a list of n elements, such as qw(A B C D), I need to iterate

through all possible combinations, starting with the full combination

of n elements (A B C D), then (in any order) all combinations with

n-1 elements, such as (A B C), (A B D), (B C D), etc., then all

combinations with n-2 elements, and so on.



Any advice on how?



Thanks,

John McCaskey (jpm@epiphany.com)

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Fri, 05 Jun 1998 22:32:00 -0700
From: David Barr <dafydd@jps.net>
Subject: Re: I'm having problems:
Message-Id: <3578D450.40657CF8@jps.net>

John Porter wrote:
> 
> (sniff, sniff: hmmm. hw?)
> 
> Chris Reynolds wrote:
> >
> > I'd also like so that if the script is not provided exactly one
> input
> > parameter or that parameter is a not a directory, a Usage message is
> > displayed ...
> 
> ( @ARGV == 1 and -d $ARGV[0] ) or die "Usage: $0 directory\n";
> 
> hth,
> John Porter


Either I read something wrong, or it should be

( @ARGV == 2 and -d $ARGV[1] ) or die "Usage: $1 directory\n";

right?   Isn't $ARGV[0] the name of the perl script itself?

Cheers,
David


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

Date: Sat, 6 Jun 1998 09:12:38 GMT
From: jcomeau@world.std.com (John O Comeau)
Subject: Re: I'm having problems:
Message-Id: <Eu4HL2.8MA@world.std.com>

Nope, $0 is the name of the script, $ARGV[0] is the first arg, $ARGV[1]
the second, usw, and $1 doesn't mean a damn thing until you do a pattern
match with at least one pair of parentheses...

(You likely already found that out, to your chagrin, after posting...
don't feel too bad, most of us do something like that now and again) - jc

David Barr (dafydd@jps.net) wrote:

: ( @ARGV == 2 and -d $ARGV[1] ) or die "Usage: $1 directory\n";

: right?   Isn't $ARGV[0] the name of the perl script itself?

: Cheers,
: David
-- 
jcomeau@world.std.com aka John Otis Lene Comeau
Home page: http://world.std.com/~jcomeau/
Disclaimer: Don't risk anything of value based on free advice.
"Anybody can do the difficult stuff. Call me when it's impossible."


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

Date: Sat, 06 Jun 1998 17:36:33 +1000
From: Andrew Gruskin <agruskin@melbpc.org.au>
Subject: Re: Lotus Notes from perl?
Message-Id: <3578F181.74C957D5@melbpc.org.au>

murple@erols.com wrote:

> I need to be able to communicate between perl scripts (running on Linux boxen)
> and databases running on a Lotus Notes server (running on NT). I need to be
> able to both read from and write to the Notes database. My knowledge of Notes
> is virtually non-existent. I've seen that there is a C and C++ API for Notes
> but it is only for Solaris and HPUX, not Linux, and even if it were available
> on Linux, it would still require a perl interface be written.
>
> Has anyone else had to do something similar? Does anyone have any ideas on how
> to go about this, or suggestions on where to look for possible leads? Aside
> from the C/C++ APIs, I haven't been able to find anything useful on the net.

Using Win32::OLE you can drive Notes.  I have Perl scripts creating Notes
documents and then sending (emaiing) them.

Alternatively, there is also an ODBC driver for Notes (available from the Lotus
website).



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

Date: Fri, 05 Jun 1998 23:28:26 -0500
From: Joe Halbrook <joe@halbrook.com>
Subject: Newbie: sorting of flat files ....
Message-Id: <3578C56A.BEC@halbrook.com>

I have some flat files which are comma-delimited and I need to either
write records in a sorted fashion to these files, or sort them when I'm
reading the files for reporting.

I'm suspecting this is a trivial task, but don't have quite enough time
to devote in researching it.  Does anyone have any suggestions?

Thank you in advance for your information.

-Joe Halbrook


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

Date: Sat, 6 Jun 1998 08:53:16 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Newbie: sorting of flat files ....
Message-Id: <ebohlmanEu4Gos.E6C@netcom.com>

Joe Halbrook <joe@halbrook.com> wrote:
: I have some flat files which are comma-delimited and I need to either
: write records in a sorted fashion to these files, or sort them when I'm
: reading the files for reporting.

: I'm suspecting this is a trivial task, but don't have quite enough time
: to devote in researching it.  Does anyone have any suggestion?

You might want to look at Sort::Fields over on CPAN.



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

Date: Sat, 06 Jun 1998 04:02:43 GMT
From: Guy Doucet <gdoucet@ait.acl.ca>
Subject: Novell Web Server, PERL, and base64 encoding
Message-Id: <3578C05F.AB19304@ait.acl.ca>

I have a question, here are the details:
I am using Perl5 on our Novell Web Server. It is not a UNIX box nor
WINDOWS. I have programmed a Perl script to send an email to an SMTP
server uing the following SMTP commands of RFC821, and it works ok:
====================================
   HELO
   MAIL FROM
   RCPT TO
   DATA
   QUIT
====================================
But I also want to send an attachment with the emails, and since SMTP is
a 7bit protocol and wasn't designed to send attachments, the attachment
must be encoded in with the DATA as 7bit data. As far as I know you can
do this by including MIME commands in with the data, the following is an
example of what I believe could be DATA:
====================================
   MIME Version: 1.0
   Content-Type: Multipart/Mixed; boundary=bound

   --bound
   Content-Type: text/plain

   This is a message which includes an attachment

   --bound
   Content-Type: image/jpg; filename=mountain.jpg

   (encoded data goes here)

  --bound--
====================================
But in order for this to work, I need to encode the actual data. I found
a few sites on the net that seem to indicate that UNIX Servers have
commands that do the encoding for you, I think this would be something
like that:
====================================
    use MIME::Base64;
    $encoded = encode_base64('Aladdin:open sesame');
    $decoded = decode_base64($encoded);
====================================
MY QUESTION IS THIS, does Perl5 on the Novell Web Server include similar
commands that will encode data?

All info greatly appreciated as always,
Guy Doucet



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

Date: Sat, 06 Jun 1998 04:12:08 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Novell Web Server, PERL, and base64 encoding
Message-Id: <6laflo$iq0$3@ligarius.ultra.net>

[ posted and mailed ]

Guy Doucet <gdoucet@ait.acl.ca> wrote:

<< snippo >>

-> But in order for this to work, I need to encode the actual data. I found
-> a few sites on the net that seem to indicate that UNIX Servers have
-> commands that do the encoding for you, I think this would be something
-> like that:
-> ====================================
->     use MIME::Base64;
->     $encoded = encode_base64('Aladdin:open sesame');
->     $decoded = decode_base64($encoded);
-> ====================================
-> MY QUESTION IS THIS, does Perl5 on the Novell Web Server include similar
-> commands that will encode data?

If not, you can fine the module on CPAN and install it yourself. I use a 
couple of scripts I wrote using MIME::Base64  on my Win32, Linux and UNIX 
servers.

HTH

Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-239-0341
    and hang up when the recording starts. "


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

Date: Sat, 06 Jun 1998 00:46:19 PDT
From: luckycom@ica.net
Subject: Perl - Newsgroup poster script?
Message-Id: <3578c983.0@lightning.ica.net>

anyone knows where I can get newsgroup poster script written in Perl or C without using inews and having newsserver...?

tahnks in advance
Alex

http://www.philex.net/websub/




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

Date: Sat, 06 Jun 1998 12:15:51 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Perl - Newsgroup poster script?
Message-Id: <357930c7.54342849@news.btinternet.com>

On Sat, 06 Jun 1998 00:46:19 PDT, luckycom@ica.net wrote :

>anyone knows where I can get newsgroup poster script written in Perl or C without using inews and having newsserver...?
>

If you search DejaNews you will find that this has been asked before.

This thread has got a few answers:

Subject:      posting to a newsgroup
From:         Chu Tsz-Tat <ctt@usa.net>
Date:         1997/11/29
Message-ID:   <3480BE8F.76A4@usa.net>
Newsgroups:   comp.lang.perl.misc


/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Sat, 06 Jun 1998 00:09:18 -0400
From: John Cokos <jcokos@ccs.net>
Subject: Perl 5.004_04 Won't compile on SCO Openserver 5
Message-Id: <3578C0EE.48D9DCDF@ccs.net>

Has anyone gotten Perl 5.004_04 to install on SCO Openserver 5?

For the life of me, I can't get it to compile.  It seems the 
problem is with the Dynaloader....I have to have the DynaLoader
compiled with Perl in order for Net::SSLeay to work!

(I have Perl 5.003 working perfectly, but I need to install
the LWP Module, which requires Perl 5.004_04)

Any help greatly appreciated!

John Cokos


------------------------------------------------------
The CCS Network of Web Programming Sites...
    http://www.ccs.net

The Interactive Web Commercial CGI Programs...
    http://www.interactive-web.net

CGI World ... completely CGI... 
    http://www.cgi-world.net


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

Date: Fri, 5 Jun 1998 23:53:25 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: perl equivalent to C's local static var?
Message-Id: <MPG.fe2873d4fac177a98968b@hplntx.hpl.hp.com>

In article <35786112.71C7@min.net>, jdporter@min.net says...
> Tom Christiansen wrote:
> > jdporter@min.net writes:
> > :{
> > :  my $a;
> > :  BEGIN { $a=0 }
> > :  sub f { ++$a }
> > :}
> > 
> > Interesting.  Usually one sees that as:
> > 
> >     BEGIN {
> >         my $a = 0;
> >         sub f { ++$a }
> >     }
> > 
> > For some reason I like what you wrote, but I can't pin down why.
> 
> (It was Larry Rosler's idea...)
> 
> Well, I like it because it's more comfortable to my C/asm-molded
> brain.  I.e. for a very bad reason indeed :-)
> 
> Because we know that, in C, static data gets initialized by the
> compiler at load time (i.e. by the program loader per instructions
> from the compiler).  Whereas functions don't get "initialized";
> they're simply there.
> 
> Or maybe it's some kind of aversion to polluting the BEGIN space...
> 
> John Porter

My brain was wired the same way as John's, so it seems right to me too :-
)

As I now know, all named subroutines in a file get compiled at BEGIN 
time, even if they are defined within other subroutines (which cannot 
happen in C); and their names are visible throughout the package in which 
they are defined regardless of how they are embedded (in C, all functions 
have file scope from their definition or first declaration).  So  
defining a Perl subroutine in a BEGIN block seems somehow supererogatory.

One might say as much for the initialization to 0 in the above examples, 
because of the mystical behavior of ++:  undef $a; ++$a;  and $a is 
quietly 1, even with warnings enabled.  But if $a is intended to start at 
any value other than 0, it had best be initialized at BEGIN time, before 
the incrementing subroutine is called.

-- 
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com


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

Date: Sat, 6 Jun 1998 11:48:54 +0100
From: "Karl" <kisaac@enterprise.net>
Subject: Problem with Win32
Message-Id: <6lb6r9$sh3$1@news.enterprise.net>

Can anyone tell me why this doesn't work?

    use Win32::AdminMisc;
    $USER = "phyl";
    if ( Win32::AdminMisc::UserSetMiscAttributes("", "$USER",
    USER_FULL_NAME, "fred") ) {
     print "Updated $USER\n";
    }
    if ( Win32::AdminMisc::UserGetMiscAttributes("", "$USER", \%ATTRIBUTES)
    ){
            print "Phyl's new name $ATTRIBUTES{USER_FULL_NAME}\n";
    }

It produces the output:
    Updated phyl
    Phyl's new name Phyl Smith
In other words the "set" doesn't appear to work.

Using Perl 5.003_007 from ActiveState build 316
Admin::Misc from www.roth.net build 311
Thanks for any help.
Karl.





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

Date: 06 Jun 1998 04:29:56 -0700
From: Xah Lee <xah@shell13.ba.best.com>
Subject: Q: drop a 'slice' in list
Message-Id: <yo3iumevkcr.fsf@shell13.ba.best.com>


How can I delete a sequence of elements of a **LIST** in one line? (one semicolone)
To illustrate, the following drop the last 3 elements using two lines.

my @aa = split(m( ),'Dvorak keyboard is wonderful. Eh eh eh?');
my @result = @aa[0 .. $#aa-3];

where I wished something like

my @result = ... split(m( ),'Dvorak keyboard is wonderful. Eh eh eh?') ...;

Thanks.

 Xah
 xah@best.com
 http://www.best.com/~xah/SpecialPlaneCurves_dir/specialPlaneCurves.html
 Q: is there a language that's completely ideom/sugar-syntax free?


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

Date: Sat, 6 Jun 1998 09:38:24 +0100
From: "Tan" <tan@jettech.dircon.co.uk>
Subject: Reading a file from the bottom up
Message-Id: <3578ffac.0@newsread1.dircon.co.uk>

Hi,

Is there a way to read files starting from the end?

Data coming in from a switch appends to a file so that the most recent
records are at the end of the file. To reduce processing time I would like
to start searching for the most recent data and so would like to start
reading from the end of the file to the beginning in order to cut processing
time down.

Any help would be gratefully appreciated.

Regards
Tan






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

Date: Sat, 06 Jun 1998 12:15:54 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Reading a PDF file with Perl
Message-Id: <357932a1.54816523@news.btinternet.com>

On Fri, 05 Jun 1998 22:08:58 GMT, mike_lottridge@mentorg.com wrote :

>I'm looking for a perl script that will convert PDF to text, for simple
>searching. Alternatively, a command line utility for Win95 that would convert
>a PDF to a text file could be a workaround, that the perl script could call
>as needed.
>

There is a module on CPAN that purports to do something with PDF files
but I couldnt tell you whether converting to text is one of them:

http://www.perl.com/CPAN-local/authors/Antonio_Rosella/

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Sat, 6 Jun 1998 03:37:58 -0400
From: "gateway" <betabeta@geocities.com>
Subject: Stupid syntax question
Message-Id: <6larkq$19bo$1@news.gate.net>

    I just started learning Perl, so forgive me if this is stupid. I can't
seem to get the syntax right. what I want to do is use a loop to cycle
through all elements in an array, one at a time, using a variable as the
array index (ie &array[$counter]). can someone clear this up for me.
I'm sorry if this sounds simple, but I've tried everything I can think of.

Zen




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

Date: Sat, 06 Jun 1998 12:15:48 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Stupid syntax question
Message-Id: <35792701.52059013@news.btinternet.com>

On Sat, 6 Jun 1998 03:37:58 -0400, gateway wrote :

>    I just started learning Perl, so forgive me if this is stupid. I can't
>seem to get the syntax right. what I want to do is use a loop to cycle
>through all elements in an array, one at a time, using a variable as the
>array index (ie &array[$counter]). can someone clear this up for me.
>I'm sorry if this sounds simple, but I've tried everything I can think of.
>

I'm pretty certain you didnt mean &array[$counter] as that would be an
array of subroutines.

What you probably meant was $array[$counter].

A typical idiom might be:

#!perl

@array = qw(1 2 3 4 5 6 7 8 9 10);

for(0 .. $#array)
{
  print $array[$_] ,"\n";
}

If you actually wanted to use an index to access each element of the
array.  If you only wanted to obtain the value of each element (not
the element itself) you could use

for(@array)
{
   print $_,"\n";
}

for example.

You almost certainly want to look at the perlfaq4 document though.  In
fact you should have done before you posted here but I'm feeling
benevolent today (although I did just turn away a reformed offender
from the door wh was selling tea towels).

/J\

/J\

Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: Fri, 05 Jun 1998 19:50:15 +0200
From: Jochen Wiedmann <joe@ispsoft.de>
Subject: Uploading mirror
Message-Id: <35782FD7.716E72@ispsoft.de>

Hello,

I suppose most of you know mirror.pl, which mirrors a remote site
by downloads via FTP. As far as I know, this is for downloads only,
although I don't know a technical reason. Does anyone know of a
similar solution for uploads?


Thanks,

Jochen


-- 
Jochen Wiedmann					joe@ispsoft.de
Linux - Just do it!				07123 14887




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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 2799
**************************************

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