[7152] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 777 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 25 06:17:18 1997

Date: Fri, 25 Jul 97 03:00:24 -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           Fri, 25 Jul 1997     Volume: 8 Number: 777

Today's topics:
     Array n dimensions <quelin@eret.cegelec-red.fr>
     BUG: inheritance (Marek Rouchal)
     Delete a file <pkolonel@mnsi.net>
     file upload: Netscape vs MSIE <koolwaaij@let.kun.nl>
     Re: HELP: Innocuous return stmt yields errors <rootbeer@teleport.com>
     How to call a package/method from a variable? <schattev@imb-jena.de>
     I'm confused <zlash@kalron.sby.omah>
     Re: I'm confused (Lennie Jarratt)
     Is file open/closed? <sasha@sanet.ge>
     Re: Is there a tool similar to lex and awk combined (Jason E Holt)
     Re: JED Editor for Perl--Keypad problem <jpm@iti-oh.comNOSPAM>
     Matching lowercase in regexp? (Jason H. Elbaum)
     Re: multi-dimensional arrays in PERL - How ? (Danny Aldham)
     open error on network drives santon@gwsmtp.nu.com
     Re: Performance benefits for homogeneous structures? <ajohnson@gpu.srv.ualberta.ca>
     Perl and Reading Email (Custom Computer Services Inc.)
     Please comment: perl (NNTP) gateway <M.Turcotte@icrf.icnet.uk>
     Problem with SQLPerl3.2 or my understanding of it... <sm@rssmnet.com>
     Re: python envy ? (Bennett Todd)
     Re: python envy ? (Linux Enthusiast)
     Re: python envy ? <rra@stanford.edu>
     Q: associative arrays <Uwe.Lammers@astro.estec.esa.nl>
     Re: Sorting <rra@stanford.edu>
     Re: text processing (Nic Gibson)
     Re: Too many people in this group are arrogant #*(@# (R <flavell@mail.cern.ch>
     Re: Trimming leading and trailing spaces. <sibsib@hotmail.com>
     Web based mail client <matt@dotshop.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 25 Jul 1997 04:02:10 -0600
From: Jerome Quelin <quelin@eret.cegelec-red.fr>
Subject: Array n dimensions
Message-Id: <869820443.10247@dejanews.com>

Hi,

How can I use (or simulate ?) array of n dimensions ?
How can manipulate them ?

Thanks,
Jerome
--
Jerome Quelin
email: quelin@eret.cegelec-red.fr

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: 25 Jul 1997 11:27:05 +0200
From: Marek.Rouchal@-nospam-hl.siemens.de (Marek Rouchal)
Subject: BUG: inheritance
Message-Id: <5r9rh9$et3@buffalo.HL.Siemens.DE>
Keywords: STDIN,system,newgrp,id

I've stumbled across a bug in STDIN inheritance (Perl 5.00305, Sun
Solaris 2.5.1): Consider this script:

#!/usr/local/bin/perl -w

chomp($group = <STDIN>);
print qq{Group is "$group"\n};
system('newgrp',$group);
__END__

When started, it stops for the entry of a group-ID. When the group ID is
entered, the newgrp shell starts up and when the command 'id' is typed, the
correct (new) group ID is printed.
Consider a file 'infile' that contains the two lines:
-----
<groupname>
id
-----
When the script is invoked as 'script < infile', the newgrp command does
not get the 'id' command and exits without printing the ID.

On the other hand, if you modify the script so that it does NOT use
<STDIN>, e.g.

#!/usr/local/bin/perl -w

$group = $ENV{'NEWGROUP'};
print qq{Group is "$group"\n};
system('newgrp',$group);

it works both ways, i.e. STDIN may be a tty or reading from a file.

To me it seems that one I've read from <STDIN>, system() does not inherit
the right stdin. Does a workaround exist for that?

Regards,

Marek

PS. To send reply by Email, please remove -nospam- from the address. Thank You.


-- 
  Marek Rouchal                   Phone : +49 89/636-25849
     SIEMENS AG, HL CAD SYS       Fax   : +49 89/636-23650
     Balanstr. 73                 mailto:Marek.Rouchal@-nospam-hl.siemens.de
     81541 Muenchen               PCmail:Marek.Rouchal.PC@-nospam-hl.siemens.de


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

Date: Fri, 25 Jul 1997 05:40:13 -0400
From: "Peter Kolonelos" <pkolonel@mnsi.net>
Subject: Delete a file
Message-Id: <5r9rrk$lbu@backup.mnsi.net>

I have written a perl/cgi script but I need help with the following:

The script constructs an html file with frames. In one of the frames, I need
to modify the html file independently. For example, frame1 contains top.htm,
frame2 contains left.htm, etc.

I want to check top.htm if it is empty. If it is NOT empty, I want to delete
the file and then create a new file with the same name with new contents
generated by my script. Is this possible?

Any help would be greatly appreciated.





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

Date: Fri, 25 Jul 1997 10:36:46 +0200
From: Johan Koolwaaij <koolwaaij@let.kun.nl>
Subject: file upload: Netscape vs MSIE
Message-Id: <33D8659E.64E5@let.kun.nl>

Dear all who have (had) problems with file upload,

I tried to produce a html page which was capable to
make a file upload possible. Code used:

 <form method="POST" enctype="multipart/form-data"
 action="nph-fup.cgi"><input type="file" name="upfile">
 <input type="submit" value="Klik"></form>

nph-fup.cgi shows like:

 #!/bin/perl
 require "./cgi-lib.pl";
 print "HTTP/1.0 200 OK\n";
 $ret = &ReadParse;
 &CgiDie (@in);

The function readparse is in cgi-lib.pl (v2.14)

This all worked great with Netscape 3.0, but MSIE had
severe difficulties. First I had version 3.0.2. But the
<input type=file> tag gave no browse button and instead
of the file content the file nam was submitted. But hurray
MS has an add-on for file upload. No idea what the function
of that add-on was (is), but the only thing that happened
on submit_form was nothing. It appeared that 3.0.2 did not
support multipart/form-data.

OK, let's go to MSIE 4.0 preview 2. That's better but in
the readparse function MSIE 4.0 went into an eternal loop
because the "last PART if" was not satisfied.
Therefore I added a line to cgi-lib.pl
      last PART if (substr($buf, $bpos + $blen, 4) eq "");

And now it worked with 4.0, but still not with 3.0.2 + add-on.

If you have (helpful) comments please mail me.

Regards,

Johan Koolwaaij





-- 
 \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
 \_   Johan Koolwaaij  (koolwaaij@let.kun.nl)            \_
 \_   Dept. of Language and Speech, Nijmegen University  \_
 \_   Tel   : +31 (0)24 - 3615820                        \_
 \_   URL   : http://lands.let.kun.nl/TSpublic/koolwaaij \_
 \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_


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

Date: Tue, 22 Jul 1997 12:41:21 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: tbrannon <tbrannon@nunki.usc.edu>
Subject: Re: HELP: Innocuous return stmt yields errors
Message-Id: <Pine.GSO.3.96.970722123751.6115M-100000@kelly.teleport.com>

On 22 Jul 1997, tbrannon wrote:

> 	if spike_at($i) {

Oops. The conditional in an 'if' statement must be parenthesized. Not that
that has anything to do with your return statement... :-)  (I suspect that
there's some of your program that you're not showing us, and that that
part has the real errors.) Hope this helps! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/




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

Date: Tue, 22 Jul 1997 13:14:26 +0200
From: Ruben Schattevoy <schattev@imb-jena.de>
Subject: How to call a package/method from a variable?
Message-Id: <33D49612.1D99@imb-jena.de>

Hi,

I want to use something like this:

require "DIR/$package.pm";
$object = DIR::$package->new();

Perl complains:

"Bad name after DIR:: at my_program line nnn."

The only solution I have found so far is to use a if-elsif-block like
this:

require "DIR/$package.pm";
if      ( $package eq "packageA" ) {
  $object = DIR::$packageA->new();
} elsif ( $package eq "packageB" ) {
  $object = DIR::$packageB->new();
}

But this is quite a poor sulution. Isn't it?

Ruben
-- 
Ruben Schattevoy

Institut fuer Molekulare Biotechnologie,
Beutenbergstrasse 11,
07745 Jena,
Germany


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

Date: Fri, 25 Jul 1997 03:35:09 -0500
From: Saeba Ryo <zlash@kalron.sby.omah>
Subject: I'm confused
Message-Id: <Pine.OSF.3.91.970725032301.2063A-100000@alpha2.csd.uwm.edu>

Hi there,

I'm new to perl and I am writing a simple script now.
It is something like this

open (IF, "somefile");
array = &functionA(IF);

now functionA is something like
local *IFF = shift;
my $i=1, @temp;
while (<IFF>){
   print "Line num= $i++";
   push temp, $_;
}
return temp;

OK the program runs exactly like I wanted, it prints the line number
simultaneously while the functionA reads the file (line by line)

Then I added more lines of code to the functionA and now when I run the
program it just wait until it reads the whole file (until EOF) then it
prints the line numbers as if it's not inside the while loop.

I need to print the line simultaneously while reading the file since it 
will tell me the progression of the reading (ie, Reading line 80)

Any advice would be appreciated.

ps: Second question, can we find the total number of lines in a file
from the file handle? (of course without reading the whole file first)
I want to produce something like Reading line 80/1000

Thank you.
U.D

                
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
		\=/,         _-===-_-=======-_-===-_-=============-_-====-_
                |  @___oo   (                                              )_
      /\  /\   / (___,,,}_--=     ___             ___            _          )
     ) /^\) ^\/ _)        =__    | . \ _ _  ___  / __> ___  ___ | |_  __    )
     )   /^\/   _)          (_   |   /| | |/ . \ \__ \<_> |/ ._>| . \<_> |   )
     )   _ /  / _)            (  |_\_\`_. |\___/ <___/<___|\___.|___/<___|  )
 /\  )/\/ ||  | )_)            (_     <___'                                 )
<  >      |(,,) )__)             (                                         )
-||------/    \)___)\-------------(_                                       __)
 | \____(      )___) )_v_           -====-_____-========-_____-======-___==   
  \______(_______;;; __;;;      v  v                          x  v   v 
      __==                          v       _==---===VV===  v   v        v
____________________________________________________________________________



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

Date: Fri, 25 Jul 1997 09:28:14 GMT
From: lbj_ccsi@atl.mindspring.com (Lennie Jarratt)
Subject: Re: I'm confused
Message-Id: <5r9rgc$vlu@camel3.mindspring.com>

Saeba Ryo <zlash@kalron.sby.omah> wrote:

>Hi there,

>I'm new to perl and I am writing a simple script now.
>It is something like this

>open (IF, "somefile");
>array = &functionA(IF);

>now functionA is something like
>local *IFF = shift;
>my $i=1, @temp;
>while (<IFF>){
>   print "Line num= $i++";
>   push temp, $_;
>}
>return temp;

>OK the program runs exactly like I wanted, it prints the line number
>simultaneously while the functionA reads the file (line by line)

>Then I added more lines of code to the functionA and now when I run the
>program it just wait until it reads the whole file (until EOF) then it
>prints the line numbers as if it's not inside the while loop.

What did you add?

>ps: Second question, can we find the total number of lines in a file
>from the file handle? (of course without reading the whole file first)
>I want to produce something like Reading line 80/1000

Try doing a UNIX command like:
	 wc -l

This will return the number of lines to stdout. Read that and you are
set.




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

Date: Fri, 25 Jul 1997 03:11:11 -0600
From: Alexander Pfandt <sasha@sanet.ge>
Subject: Is file open/closed?
Message-Id: <869817762.9228@dejanews.com>

   Hi All!

 Some days ago I made a small script that adds newly uploaded file to
special list (in fact it's a homepage with links to new files). After
the script moves (by executing "system mv" command) file to another dir
(accessed by httpd). All seems to work fine but one. Files are uploaded
via ftp by dialup users and my script is executed from crontab each
minute. So main question is: "HOW CAN I FIND IF THE FILE IS OPEN (BEING
STILL UPLOADED) AND SKIP IT?".
 I saw alike message in this newsgroup but can't make flock work. Even
if the file is open mv moves it and flock seems to function without error!
But I need error!
 Please, be so kind, and drop me a couple of lines explaining the method.


                                                     Sincerely Yours,
                                                     Alexander Pfandt

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: 22 Jul 1997 01:02:04 GMT
From: holt@puree.cs.byu.edu (Jason E Holt)
Subject: Re: Is there a tool similar to lex and awk combined
Message-Id: <5r10qc$gss@hamblin.math.byu.edu>

Randal Schwartz (merlyn@stonehenge.com) wrote:
: >>>>> "Antony" == Antony & Minimol <antony@exit109.com> writes:

: Antony> Hi all
: Antony> 	I am looking for a tool which is similar to lex with interpreting
: Antony> capability of awk or perl. This tool should treat input as stream of
: Antony>  characters not as
: Antony> stream of records. When a pattern matches, it should perform some
: Antony> action.
[...]
: Would this kind of Perl pattern work for you?

: 	undef $/;
: 	$_ = <>;
: 	{
: 		s/^firstpat// and &action_for_firstpat(), redo;
: 		s/^secondpat// and &action_for_secondpat(), redo;
: 		s/^thirdpat// and &action_for_thirdpat(), redo;
: 		die "can't recognize $_";
: 	}
[...]

	I had just the same sort of problem a while ago while trying to
write a scanner for a compiler class.  The problem with using <> and $_
appears when matching tokens which may continue over multiple lines - 
strings and comments are two such tokens in many languages.  One
solution (the first suggestion in this thread) suggests slurping the
entire file into a single string, then doing this sort of thing:

if( $foo =~ /^([a-zA-Z_]\w*)(.*)/ ) { $foo = $2; &handle($1); }

	This looks rather inefficient to me, though.  Order t*n in fact,
when t is the number of tokens in the file and n is the length of the
file.  Another problem is that keeping track of the current line number
is difficult.  

	Another solution would be to look for the beginning of such 
multiline tokens, and then loop until the end is found.  But that comes
at the cost of complexity and special cases.

	I keep wanting a thunk.  Or some sort of regex which would read
ahead in a stream as far as needed.  Hm.  Maybe I'm just taking too many
CS classes...

				-J


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

Date: 23 Jul 1997 13:46:41 GMT
From: "Joshua Marotti" <jpm@iti-oh.comNOSPAM>
Subject: Re: JED Editor for Perl--Keypad problem
Message-Id: <01bc976e$d19a5340$36601ec6@bach>

JED works fine for me, including the num lock in winNT

-- 
Josh,
Gavin Dragon...
Remove NOSPAM from address...



Jason Pociask <pociask@maricopa.edu> wrote in article
<33D5744A.431A@maricopa.edu>...
> I'm trying to use the JED editor on Win95 to edit PERL sources
> using the EDT (VAX'ish) mode.  The numlock key won't lock in to
> applications mode even though I ran the recommended MSUGOLD.COM
> TSR program first.  Can someone tell me if I will ever get this
> to work under Win95 or WinNT, or was it a Win 3.1 only thing?
> 
> TIA, and sorry if this is tangential to the topic at hand.
> 
> -JP
> 


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

Date: 23 Jul 1997 12:15:59 +0100
From: jhelbaum@holly.mr (Jason H. Elbaum)
Subject: Matching lowercase in regexp?
Message-Id: <50iuy29fyo.fsf@holly.mr>


Here's a short, simple one that I've been unable to find in
the perl docs:

Is there a regexp meta-character which will match only an uppercase
or only a lowercase letter?  Or should I use [A-Z] and [a-z]?
I would have thought the latter not to be recommended due to
potential locale issues.

Thanks,


Jason H. Elbaum
j.elbaum@ic.ac.uk




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

Date: 24 Jul 1997 08:21:01 -0700
From: danny@lennon.postino.com (Danny Aldham)
Subject: Re: multi-dimensional arrays in PERL - How ?
Message-Id: <5r7rst$l1$1@lennon.postino.com>

Dominic Feeley (D.Feeley@unixa.nerc-wallingford.ac.uk) wrote:
: I have tried to set up a multi-dimensional array in PERL 5,
: but am having no luck in accessing the array. 
: Could someone give me an example so I can have a 
: two-dimensional array, or a pointer to some tutorials. I've looked in
: "Learning PERL" and "Programming PERL", but they haven't 
: helped me. Neither did a search on the web.

In "Programming Perl", 2nd edition, I look in the index and
multidimensional hashes points to page 270. 
This little script should also show you what is done.
 
#!/usr/bin/perl -w
# multi-dimensional array hack
# Simulate an array with rows(row#) and columns(col#)
#  
# initialize test hash
%hash = ( 'row1' => {'col1' => 'row1col1', 'col2' => 'row1col2'},
          'row2' => {'col1' => 'row2col1', 'col2' => 'row2col2'}
        );
# print out the values of the hash
foreach $key1 (keys %hash) {
  foreach $key2 (keys %{$hash{$key1}}) {
    print '$hash{', $key1, '}{', $key2, '} = ', $hash{$key1}{$key2}, "\n";
  }
}
                             
--
Danny Aldham           SCO Ace , MCSE , JAPH , DAD
I don't need to hide my e-mail address, I broke my sendmail.


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

Date: Fri, 25 Jul 1997 02:35:30 -0600
From: santon@gwsmtp.nu.com
Subject: open error on network drives
Message-Id: <869815315.8299@dejanews.com>

I'm currently using Perl 5.001 for Win32.  I'm connected to a Novell
Network.  My perl scripts run fine on the local hd, but when I try to open
a file as in the following script it dies.  I've installed 5.004 and the
same thing happens.  What gives?  BTW, Perl 4.036 runs a similar script
just fine.  The file is actually created, length zero, but I cannot output
to it.  Thanks in advance.

open (LOG,"> log") or die "Unable to open file...\n";
print LOG "Test\n";

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Thu, 24 Jul 1997 16:01:49 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Performance benefits for homogeneous structures?
Message-Id: <33D7C2BD.AEC3F99@gpu.srv.ualberta.ca>

Russ Allbery wrote:
> 
> [ Posted and mailed. ]
> 
> dave <over@the.net> writes:
> 
> > With perl I can create a hash of hashes.  Is there performance benefits
> > gained by making each hash within the hash have the same keys (different
> > values for each key)?
> 
> Not that I know of, nor can I think of any particular reason why there
> should be.
> 

however, unique keys are now only allocated once according
to the perldelta manpage:

	Each unique hash key is only allocated once, no matter how
	many hashes have an entry with that key.  So even if you
	have 100 copies of the same hash, the hash keys never have
	to be reallocated.

regards
andrew


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

Date: Fri, 25 Jul 1997 08:52:42 GMT
From: lbj_ccsi@atl.mindspring.com (Custom Computer Services Inc.)
Subject: Perl and Reading Email
Message-Id: <5r9pdp$vlu@camel3.mindspring.com>

Does anyone no of any Perl scripts that allow the user to read their
email?  It is easy to handle the text docs, but decoding the MIME
formats is not as simple.

Thanks, any help will be greatly appreciated.

Lennie



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

Date: Fri, 25 Jul 1997 10:45:14 +0100
From: Marcel Turcotte <M.Turcotte@icrf.icnet.uk>
Subject: Please comment: perl (NNTP) gateway
Message-Id: <33D875A8.365A1EF3@icrf.icnet.uk>

Hello all,

I wrote the following piece of code, it acts as a software gateway,
providing access to a machine (A), by the mean of an intermediate
machine (B), to a third machine (C); that would not normally have
direct access to machine (A).  For example, someone would use it to
read his/here news from a host not served by an NNTP server.

This is the first time I write something like this
(perl/socket/client/server) and I am seeking comments:

- Is there something equivalent already available?

- Would it be useful to make it clean and robust?  Would you use it?

- It's creating zombies, what's wrong?

- It's not always writting to the log file, why?

To do list:

- IP filtering

- Better logs

- ?

Any comments/suggestions will be greatly appreciated.
Cheers!
Marcel

#! /usr/local/bin/perl
#                              -*- Mode: Perl -*- 
# gw.pl --- perl gateway server
# Author          : Marcel Turcotte (M.Turcotte@icrf.icnet.uk)
# Created On      : Mon Jul 21 17:38:47 1997
# Last Modified By: Marcel Turcotte
# Last Modified On: Mon Jul 21 18:08:21 1997

#            (client)        gw.pl      (server)
#  left <--  port/host  <-- GateWay <--  port    <-- right
#       -->  usenet/119 --> Server  -->  32853   -->
#
$left_host = 'news';
$left_port = 119;
$right_port = 32853;

open(GWLOG, '>>./gw-log') || die "Can't open gwlog file $!";
select(GWLOG);

print "Gateway started\n";

require 'sys/socket.ph';

# Common

$sockaddr = 'Sna4x8';
($name, $aliases, $proto) = getprotobyname('tcp');

# Interface to the left (client)

$SIG{'INT'} = 'dokill';
sub dokill { kill 9,$child if $child; }

($name, $aliases, $type, $len, $left_addr) = gethostbyname($left_host);
$left = pack($sockaddr, &AF_INET, $left_port, $left_addr);

chop($hostname = `hostname`);

($name, $aliases, $type, $len, $thisaddr) = gethostbyname($hostname);
$this = pack($sockaddr, &AF_INET, 0, $thisaddr);

# Interface to the right (server)

($name, $aliases, $right_port) = getservbyname($right_port, 'tcp')
     unless $right_port =~ /^\d+$/;

$rightaddr = pack($sockaddr, &AF_INET, $right_port, "\0\0\0\0");

select(NRIGHT); $| = 1; select(GWLOG);

socket(RIGHT, &PF_INET, &SOCK_STREAM, $proto) || die "socket: $!";
bind(RIGHT, $rightaddr) || die "bind: $!";
listen(RIGHT, 5) || die "connect: $!";

select(RIGHT); $| = 1; select(GWLOG);

for (;;) 
{

    # waiting for a request

    print "Listening again\n";
    ($addr = accept(NRIGHT,RIGHT)) || die $!;
    print "accept ok\n";

    ($af,$right_port,$inetaddr) = unpack($sockaddr,$addr);
    @inetaddr = unpack('C4',$inetaddr);
    print "$af $right_port @inetaddr\n";

    # got a request, connecting to left-hand side host

    # include code that checks if IP is allowed to connect

    socket(LEFT, &PF_INET, &SOCK_STREAM, $proto) || die "socket: $!";
    bind(LEFT, $this) || die "bind: $!";
    connect(LEFT, $left) || die "connect: $!";

    select(LEFT); $| = 1; select(RIGHT);

    if ($child = fork) {
	# parent
	while (<NRIGHT>) {
	    print LEFT;
	}
	sleep 3;

	do dokill();
    }
    else {
	# child
	while (<LEFT>) {
	    print NRIGHT;
	}
    }
}

print "Gateway shut down\n";
close(GWLOG);


-- 
              Marcel Turcotte              Biomolecular Modelling Laboratory
    [44|0]-171-269-3023/3479 Phone/Fax     Imperial Cancer Research Fund
         M.Turcotte@icrf.icnet.uk          44 Lincoln's Inn Fields (Room G17)
http://bonsai.lif.icnet.uk/people/turcotte London WC2A 3PX, England


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

Date: 25 Jul 1997 06:53:08 GMT
From: "Shawn M" <sm@rssmnet.com>
Subject: Problem with SQLPerl3.2 or my understanding of it...
Message-Id: <01bc98c6$c2bc5400$9f23cfa9@fluidone>

Every time I try to create a table in SQL Perl3.2 I get the following error
message:

Can't call method "sync" without a package or object reference at
/web/guide/rss
mnet/cgibin/sqlperl3_2.pl line 1660.
END failed--cleanup aborted.     


Can anyone help me with this, or know where I can find this sync();?

Thanks.

Shawn
     


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

Date: 24 Jul 1997 21:06:13 GMT
From: bet@network.rahul.net (Bennett Todd)
Subject: Re: python envy ?
Message-Id: <slrn5tfgtf.fmm.bet@waltz.rahul.net>

I dunno. I don't think I really disagree with your conclusion, but I sure get
there a different route:-).

Perl grew up as Lwall's Do What I Mean language, and it has come along
amazingly well; its lasting beauty and usefulness is a testimonial to lwall's
superb linguistic aesthetics.

Python grew out of a more academic community with more academic roots, and by
golly it shows. Python is much more elegant and simple. Thanks to combining a
really fruitful assortment of ideas --- many of them nicked from the lisp
community --- Python is also quite powerful, and a good many people enjoy
getting work done with it.

Perl, by contrast, isn't as closely affiliated with academic roots --- or
at least not computer science ones:-). It's a powerful tool for software
engineering whose design aesthetics were formed by someone who knew
linguistics. No surprise, Perl can get anything done, generally many different
ways. From a computer science academic's point of view perl is not elegant;
it's a long, long way from minimalist. But those of us who like it find it a
comfy tool that wears well with time.

And part of its aging gracefully includes borrowing good ideas from wherever
they can be found. I wasn't involved with the development and so don't know
for certain, but it really looks to me like perl5's added features --- the
things tossed into the language from perl 4 to perl 5 --- were largely
borrowed from python. Python looked like a strong language compared to perl4;
I think it offers nothing new and superior over perl5. Some people like it
better; others like perl better; and I think that comes down to a matter of
taste.

-Bennett


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

Date: 25 Jul 1997 07:25:59 GMT
From: brett@teleport.com (Linux Enthusiast)
Subject: Re: python envy ?
Message-Id: <slrn5tgldk.co.brett@teleport.com>

In article <Pine.GSO.3.96.970724143254.10589C-100000@kelly.teleport.com>, Tom Phoenix wrote:
>On 24 Jul 1997, Bruce Dumes wrote:
>
>> What seems funny to me, though, is that in my studies, I see the python
>> groups constantly comparing python to perl to show why python is the one
>> and true scripting language, but I rarely see perl afficianos saying
>> that anything python can do, perl can do better. 
>
>No, we're too busy saying that anything Java can do, Perl can do better.
>:-)

Except become as ubiquitous as java, unfortunately :-(

-B


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

Date: 25 Jul 1997 00:55:11 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: python envy ?
Message-Id: <m367tz4lcw.fsf@windlord.Stanford.EDU>

Linux Enthusiast <brett@teleport.com> writes:
> Tom Phoenix wrote:

>> No, we're too busy saying that anything Java can do, Perl can do
>> better.  :-)

> Except become as ubiquitous as java, unfortunately :-(

Perl is already a good bit more ubiquitous than Java, just not as widely
hyped.  You're forgetting that *most* Perl scripting has nothing to do
with the web and isn't done by people who deal directly with the user end
of things.

The amount of existing Perl code automating system administration tasks is
staggering.  Uncountable numbers of things on our systems would fail
without Perl, from quota administration to account creation.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Fri, 25 Jul 1997 10:30:51 +0200
From: Uwe Lammers <Uwe.Lammers@astro.estec.esa.nl>
Subject: Q: associative arrays
Message-Id: <33D8643B.6838@astro.estec.esa.nl>

Hi,

another newbie question: Is there a way to force Perl to iterate over
the elements in an associative array in the order as it was given in
the array definition?
Example:

%dum = ( '3', '3', '1', '1', '2', '2' );

while (($key, $val) = each(%dum)) {
   print "$key/$val\n";
}

This prints (not surprisingly):
1/1
2/2
3/3

but I want to see;

3/3
1/1
2/2

You may ask why I do not use normal arrays but I have good reasons not
to do so ...

Cheers
Uwe. (ulammers@astro.estec.esa.nl)


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

Date: 23 Jul 1997 02:15:07 -0700
From: Russ Allbery <rra@stanford.edu>
To: sanjay@rocketship.com (Sanjay Varma)
Subject: Re: Sorting
Message-Id: <m3204q165g.fsf@windlord.Stanford.EDU>

[ Posted and mailed. ]

Sanjay Varma <sanjay@rocketship.com> writes:

> If I have a huge text file containing data I wish to sort. Is there any
> way it could be done with Perl without reading the entire file into an
> associative array? Say coz of memory constraints.

If you have a huge text file you want to sort, you want to use the
standard Unix command "sort".  It does all sorts of buffering, paging, and
other interesting things to make the sort faster that you don't want to
try to reimplement in Perl.

It'll also consume less memory than the same algorithm implemented in
Perl.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: 25 Jul 1997 09:17:36 GMT
From: nic@cocoon.co.uk (Nic Gibson)
Subject: Re: text processing
Message-Id: <slrn5tgrl0.fg2.nic@larvae.cocoon.co.uk>

On Wed, 23 Jul 1997 11:22:41 -0700, Mehmet Demirkol 
<demirkol@sgs-server.Stanford.EDU> wrote:
>
>Hello,
>
>How can I remove all "^M"s from a piece of text?
>
>I guess I can use
>
>$text =~ s/\x??//g;

You could start by reading the manual.

>  
>but what should "??" be? Is there a web page that has a list of those
>substitude values?
>

Well, there might be. But if you were to read the perlre man page
you'd probably find the answer quicker.

$text =~ s/\cM//g;

Nic

-- 
Nic Gibson, Senior Programmer, VFM(UK) Ltd.
http://www.global-strategist.com/
Email: nic@global-strategist.com
Phone: 0171 831 7704 Mobile: 0976 408436


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

Date: Fri, 25 Jul 1997 09:25:48 GMT
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Too many people in this group are arrogant #*(@# (Re: Checking for valid Email...)
Message-Id: <Pine.A41.3.95a.970725111752.66952C-100000@sp049>

On 24 Jul 1997, John Bokma wrote:

> Too many people (even some famous ones, yes you know that I mean
> you!) reply
> on too many posting with "Read the FAQ",

So they should, if it's appropriate.

> Stupid
> questions don't
> need stupid answers, 

They'll get them anyway; I'd much rather see a well-informed answer than
the usual stream of drivel.  Given that the usual stream of drivel is
going to happen anyway, I'd still rather see a competent answer too.
Especially if it points out that a well-researched answer is already
available in the FAQ (one _should_ know that, of course, but mistakes
can happen). 

I'm only a beginner at Perl, and find a good supply of answers here,
amongst the dross; the last thing I want to do is to convince the
experts to go away, leaving only chatty dross.



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

Date: Tue, 22 Jul 1997 13:45:34 -0400
From: Scott Blanksteen <sibsib@hotmail.com>
Subject: Re: Trimming leading and trailing spaces.
Message-Id: <33D4F1BE.F5AF8BD8@hotmail.com>

Brian - DKOnline wrote:
> On Wed, 16 Jul 1997 22:44:31 -0700, Tom Phoenix
> <rootbeer@teleport.com> wrote:
> >On Wed, 16 Jul 1997, rkn wrote:
> >> Is there a simole way to trim leading and trailing spaces?
> >
> >Yes, and it's in the FAQ. Hope this helps!
> >
> >--
> >Tom Phoenix           http://www.teleport.com/~rootbeer/
> 
> What a waste of bandwidth!
> If you can't be helpful, don't post!

If you trim someone's leading and trailing spaces, he'll have no spaces
for a day.  If you teach him to read the FAQ, he'll save space
(bandwidth) for a lifetime.

Scott

-- 
Scott I. Blanksteen
sib (at) worldnet (dot) att (dot) net


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

Date: Fri, 25 Jul 1997 02:55:03 -0400
From: Matt Mankins <matt@dotshop.com>
Subject: Web based mail client
Message-Id: <33D84DC7.237C@dotshop.com>

Hi.  This is to let the perl community know that there is a web-based
perl program called Emu Mail now available for download.

Visit http://emumail.com for more information.

M


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

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

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