[20001] in Perl-Users-Digest
Perl-Users Digest, Issue: 2196 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Nov 24 14:05:33 2001
Date: Sat, 24 Nov 2001 11:05:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1006628707-v10-i2196@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 24 Nov 2001 Volume: 10 Number: 2196
Today's topics:
Re: Best language for low IQ programmers? (Patrick Doyle)
Re: Bizarre languages ( was Re: Best language for low I (Mark Jason Dominus)
CGI Problem on RedHat 7.1 <admin@bogus.thinktankdecoy.com>
Re: Creating a Perl app. Help with installation? <mcnuttj@dnps-linux1.telecom.missouri.edu>
Re: exec() and system() (Clinton A. Pierce)
file problem... <no_mto@hotmail.com>
Re: file problem... <admin@asarian-host.net>
Re: file problem... <tony_curtis32@yahoo.com>
Re: file problem... (Garry Williams)
Re: file problem... <godzilla@stomp.stomp.tokyo>
Re: file problem... <uri@stemsystems.com>
Re: modify arguments in a sub / function... <moodie@fast.net>
Re: modify arguments in a sub / function... <moodie@fast.net>
Re: modify arguments in a sub / function... <moodie@fast.net>
Re: modify arguments in a sub / function... <jeff@vpservices.com>
Re: modify arguments in a sub / function... <godzilla@stomp.stomp.tokyo>
Re: Perl Programmer Needed to modify shopping cart <uri@stemsystems.com>
Re: question for array operation (Wojtek Walczak)
Re: question for array operation <Laocoon@eudoramail.com>
Re: question for array operation (Mark Jason Dominus)
Re: question for array operation <godzilla@stomp.stomp.tokyo>
Re: question for array operation <godzilla@stomp.stomp.tokyo>
Question on substitution (Blstone77)
Re: signature error (was: Re: Difficulty with reference <5l259r001@sneakemail.com>
Uploading Files via CGI.pm (BorisVian)
Re: Uploading Files via CGI.pm <spam@phased.co.uk>
Re: Uploading Files via CGI.pm <flavell@mail.cern.ch>
Re: Uploading Files via CGI.pm <echang@netstorm.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 24 Nov 2001 13:56:46 GMT
From: doylep@eecg.toronto.edu (Patrick Doyle)
Subject: Re: Best language for low IQ programmers?
Message-Id: <GnB5EM.Fox@ecf.utoronto.ca>
In article <08utvtg6437744cjn7120ul528hjbeg25s@4ax.com>,
Gregor <gg@gg.net> wrote:
>
>As a professional web developer, I would have to say LOGO is the wave
>of the future. LOGO is an unappreciated language and easy to learn!
Actually, I agree with you! LOGO is a functional language (though
it's chock-full of side effects such as moving the turtle). I always
found LOGO very easy to program in. It's like Lisp without all the
parentheses.
If it hadn't been for the turtle, maybe it would have been taken
more seriously. :-)
--
--
Patrick Doyle
doylep@eecg.toronto.edu
------------------------------
Date: Sat, 24 Nov 2001 15:36:24 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Bizarre languages ( was Re: Best language for low IQ programmers? )
Message-Id: <3bffbe76.41a1$328@news.op.net>
In article <mequvt8kgg8tl7mvr39jkfptcvbb7uk23n@4ax.com>,
IsraelRT <israelrt@optushome.com.au> wrote:
>**" The effect of reading an Unlambda program is like habing
>your brains smashed out by a Lisp sexp wrapped around an ENIAC. You
>won't find anything like it west of Alpha Centauri.
>The Hitch-Hacker's Guide to Programming"
>
>"the following Unlambda program
>calculates and prints the Fibonacci numbers (as lines of
>asterisks)
>
>```s``s``sii`ki
> `k.*``s``s`ks
> ``s`k`s`ks``s``s`ks``s`k`s`kr``s`k`sikk
> `k``s`ksk
>
>"
This may entertain you. It's an implementation of an unlambda-like
language, as a Perl regex. (I left out the c operator, big surprise.)
The string in $_ is the program.
require 5.00553;
use re 'eval';
$|=1;
$z = qr{(?{local$d=1})
(?:`(?{$d++})
|.(?{$d--})
)+?
(?(?{$d})(?!))
}x;
$_="``As`SB``Ad``S``BS`BBI``Ae``B`SI`Ed``A?``C``CIi`pI``E?Z``BZZZZZ`KI
```CX`KIZZQZZZQZZZZZQZZZZQZ``BZZ```CX`KX`KXQ``Ee``EeZZZZZQZ```CX`KIZZQ
```CX`KIZZQZZZZQ```CXZ`KIZZQ``Ee```CX`KIZZQ``EdZZZQZ``BZZ```CX`KX`KXQ`
`BZ```CX`KIZZ`KXZQ``Ee```CX`KIZZQ``EdZZZQ``BZZZZ`KXQZ``BZZ```CX`KX`KXQ
``B```CXZ`KIZZ`KXQ``Ee``EeZZZZZQ``B``EeZZZ`KXQ``Ee``EdZZZQ``Ee```CX`KI
ZZQ``EdZZZQ``Ed``Ee```CX`KX`KI";
s/\n//g;s/Q/`KI``E?/g;s/X/IZZZ/g;s/Z/``Es/g;
1 while
s{`I($z) (?{$q=0})|``K($z)($z) (?{$q=1})
|```S($z)($z)($z)(?{$q=2})|```B($z)($z)($z) (?{$q=3})
|```C($z)($z)($z)(?{$q=4})|``A($z)($z) (?{$q=5})
|`i($z) (?{$R++,$q=6})|`p($z)(?{print(chr 120-$R), $R=0, $q=7})
|`E($z) (?{$q=8})|`V($z) (?{$q=9})
}
{local $^W;
$q<5 ?($1,$2,"``$4$6`$5$6","`$7`$8$9","``$10$12$11")[$q]
:$q==5?($bind{$13}=$14,"")
:($15,"",$bind{$17},"")[$q-6]
}ex;
__END__
Hope this helps.
Have a Turner combinatorial calulus day.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Sat, 24 Nov 2001 11:56:13 -0500
From: "$uRoot" <admin@bogus.thinktankdecoy.com>
Subject: CGI Problem on RedHat 7.1
Message-Id: <9tojch015ea@enews3.newsguy.com>
Hi. I don't do a lot of work with CGI, so was wondering if anyone knew what
the problem might be here.
I have a cgi script that I'm trying to execute straight out of the cgi-bin.
Permissions should be fine, etc. When I run it, I get a 500 Server Error.
Log shows "Premature End of Script". Looks to me like the problem is the
Perl path.
In testing, I've run it two ways from the command line:
First:
# ./script.cgi
bash: ./script.cgi: No such file or directory
This would lead me to think that the path to perl declared in the script is
wrong.
Second:
# perl script.cgi
This executes it fine.
I have Perl defined as
#!/usr/bin/perl
This is the correct path to Perl.
I've also checked the script, just to make sure there weren't any funky line
breaks or anything, don't see anything out of whack.
Any ideas?
Thanks.
------------------------------
Date: 24 Nov 2001 16:25:49 GMT
From: <mcnuttj@dnps-linux1.telecom.missouri.edu>
Subject: Re: Creating a Perl app. Help with installation?
Message-Id: <9tohmd$af$1@dipsy.missouri.edu>
As usual, I believe I sit corrected here (I rarely type standing):
Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
>>> http://www-106.ibm.com/developerworks/linux/library/l-make.html
This is an *excellent* article! Also, running 'h2xs -X' in a little dir
by itself creates a bunch of pretty good templates that one can use to
back-patch an existing perl app (like, for example, mine). :-)
> The MakeMaker stuff will handle programs in your package directory as
> well as modules. Have a look at the EXE_FILES attribute. You could
> also have a look to see how libwww for example does it. That has
> several programs that get installed.
This is the answer to the question I had about installation of the
top-level script itself (plus a few other related scripts I wrote that use
either JScan or its modules).
>> The biggest gripe I have about MakeMaker thus far, though is that
>> there seesm to be no provision (or at least, no explanation) for a
>> 'make uninstall'. A quick look at ExtUtils::Install shows that it
>> *is* in there, but there's no reference to it in the MakeMaker man
>> page nor is there any hint as to how the uninstall function is
>> intended to be actually used (there's syntax, but no *context*).
> Yep. The documentation of many things Perl is not always complete.
> Maybe you could submit some patches after you've worked it out?
Hmmm. A challenge? :-) Actually, I reverse-engineered man pages not
*too* long ago (this year) when I needed one. Now that I'll be
reverse-engineering perlpod docs using the templates made by h2xs, I just
might do this. Some of the existing perl docs could use some work.
(Oh, I'm sure I'll refer to 'man perlpod' from time to time, but unless
I'm in a time crunch I tend to remember things better if I learn them the
hard way.)
>> And there's still no help on what to do with all of the MIB files.
> Without MakeMaker there would be no help either.
Smart ass. :-P
>> The whole structure looks pretty cool (and useful), but there are
>> some gaps that need filling before I'm ready to unleash this on my
> Indeed there are.
After looking at it some more, the gaps seem primarily in the
documentation. (See above.)
> As said, you can use MakeMaker for the framework, and add anything
> else you need yourself. It still means that you'd only need to write
> and maintain part of the installation process yourself, and you can
> rest assured that your modules end up in the right place.
True.
> Instead of just looking at the docs, why don't you have a look at some
> of the Makefile.PL in the more complex CPAN distributions. libwww is
> one I already mentioned. I'm sure there are some other ones that could
> be useful as examples.
Now, now. I'm not a total mooch. :-) I did go looking at a couple of
the existing Makefile.PL's (and MakeMaker) before I started this
thread. At the time, it seemed incomprehensible, plus I didn't happen to
come across any packages that included (on purpose) non-executable files
like the MIBs I need. See below.
>> or something similar to create symlinks to my executables. How
>> does MakeMaker handle something like that?
> You write the Makefile entry :) Look at the postamble bit in the
> ExtUtils::MakeMaker documentation, under "Overriding MakeMaker
> methods".
Yup. This is it. While it would be nice if this sort of thing were a
part of MakeMaker itself, it does at least have a provision for doing some
stuff manually. Basically, this means that (as you said) I can take
advantage of whatever MakeMaker will do, and do only what's left by hand
instead of doing *everything* by hand.
Too bad I'm going to have to rename most of my modules. Check this out:
Old way:
use lib '/usr/local/lib/jscan';
use jscanconvert;
use jscangetmods;
use jscangettype;
...
New way:
use JScan::convert;
use JScan::getmods;
use JScan::gettype;
--J
------------------------------
Date: Sat, 24 Nov 2001 16:44:37 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: exec() and system()
Message-Id: <V7QL7.46145$RI2.24880412@news2>
[Posted and mailed]
In article <r8PK7.176532$zG3.531820@telenews.teleline.es>,
Patrick Bateman <coredumped@elrodri.com> writes:
> Hi:
> Is there anyway to disable system() and exec() functions on a system
> running linux? I don't want cgi's can use this functions. I already tryed
> suexec and it doesn't seems to work.
Think bigger.
Backticks, opening pipes, syscall(), are all ways of getting out of the
sandbox.
--
Clinton A. Pierce Teach Yourself Perl in 24 Hours *and*
clintp@geeksalad.org Perl Developer's Dictionary
"If you rush a Miracle Man, for details, see http://geeksalad.org
you get rotten Miracles." --Miracle Max, The Princess Bride
------------------------------
Date: Sat, 24 Nov 2001 15:12:13 +0100
From: "MAGiC MANiAC^mTo" <no_mto@hotmail.com>
Subject: file problem...
Message-Id: <9toa61$18g5$1@news.kabelfoon.nl>
I have a problem when I print a file out.
the file $fmembers looks like this :
200112
200114
200115
200119
200125
my script is this :
open(DATA,"$fmembers")||die "Could not open \"$fmembers\" for input:$!\n";
@members=<DATA>;
close(DATA);
my $lmembers=@members;
for($tmp1=0;$tmp1<$lmembers;$tmp1++){
print"\'$members[$tmp1]\'";
}
the results are :
'200112
''200114
''200115
''200119
''200125
but the results must be:
'200112'
'200114'
'200115'
'200119'
'200125'
how can I correct this in the script?...
------------------------------
Date: Sat, 24 Nov 2001 14:51:11 GMT
From: "Mark" <admin@asarian-host.net>
Subject: Re: file problem...
Message-Id: <ztOL7.98088$2w.5840293@bin4.nnrp.aus1.giganews.com>
"MAGiC MANiAC^mTo" <no_mto@hotmail.com> wrote in message
news:9toa61$18g5$1@news.kabelfoon.nl...
> I have a problem when I print a file out.
....
> @members=<DATA>;
>
> for($tmp1=0;$tmp1<$lmembers;$tmp1++){
> print"\'$members[$tmp1]\'";
> }
>
> the results are :
>
> '200112
> ''200114
> ''200115
> ''200119
> ''200125
>
> but the results must be:
>
> '200112'
> '200114'
> '200115'
> '200119'
> '200125'
>
> how can I correct this in the script?...
Since each element of your array, @members, contains a newline (\n), what
you witness is not a double '' at the beginning of each line after the
first, but simply a "wrap" of the last ' after the first newline, followed
by a new ' char.
Try something like:
chomp (@members = <DATA>);
foreach (@members) {
print "\'$_\'\n";
}
That ought to do it.
- Mark
------------------------------
Date: Sat, 24 Nov 2001 08:51:30 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: file problem...
Message-Id: <874rnk6x3h.fsf@limey.hpcc.uh.edu>
>> On Sat, 24 Nov 2001 15:12:13 +0100,
>> "MAGiC MANiAC^mTo" <no_mto@hotmail.com> said:
> I have a problem when I print a file out.
> the file $fmembers looks like this :
> 200112 200114 200115 200119 200125
> my script is this :
> open(DATA,"$fmembers")||die "Could not open \"$fmembers\" for input:$!\n";
> @members=<DATA>;
Agh, learn to indent! Some blank space doesn't hurt
either and will often aid in parsing and tokenising.
> my $lmembers=@members;
> for($tmp1=0;$tmp1<$lmembers;$tmp1++){
> print"\'$members[$tmp1]\'";
> }
That is C in disguise :-)
You can iterate directly over lists in perl:
print "'$_'\n" for @members;
or
foreach my $m (@members) {
do_something_complicated_with($m);
}
hth
t
--
Oh! I've said too much. Smithers, use the amnesia ray.
------------------------------
Date: Sat, 24 Nov 2001 15:22:12 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: file problem...
Message-Id: <slrn9vvepb.3bd.garry@zfw.zvolve.net>
On Sat, 24 Nov 2001 15:12:13 +0100, MAGiC MANiAC^mTo
<no_mto@hotmail.com> wrote:
> I have a problem when I print a file out.
>
> the file $fmembers looks like this :
>
> 200112
> 200114
> 200115
> 200119
> 200125
>
> my script is this :
#!/usr/bin/perl -w
use strict;
> open(DATA,"$fmembers")||die "Could not open \"$fmembers\" for input:$!\n";
^ ^
Those quotes are unnecessary.
> @members=<DATA>;
> close(DATA);
This cargo-cult is ill-advised. Why read the entire file into memory
only to process line-by-line?
> my $lmembers=@members;
>
> for($tmp1=0;$tmp1<$lmembers;$tmp1++){
No need for either intermediate variable. No need for a C-style
looping construct.
for ( @members ) {
> print"\'$members[$tmp1]\'";
> }
>
> the results are :
>
> '200112
> ''200114
> ''200115
> ''200119
> ''200125
That's because you failed to remove the line endings.
for ( @members ) {
chomp;
print "'$_'\n";
}
[ snip ]
> how can I correct this in the script?...
When you process each line separately, don't read the whole file into
memory before processing:
#!/usr/bin/perl -w
use strict;
while (<DATA>) {
chomp;
print "'$_'\n";
}
__DATA__
200112
200114
200115
200119
200125
Actually, the whole thing can be done on the command line by reading
stdin and writing stdout:
perl -wpe "s/^/'/;s/\$/'/" filename
(The backslash is to protect `$' from the shell. Remove it, if your
shell doesn't want the `$'.)
--
Garry Williams
------------------------------
Date: Sat, 24 Nov 2001 07:34:41 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: file problem...
Message-Id: <3BFFBE11.F579D781@stomp.stomp.tokyo>
MAGiC MANiAC^mTo wrote:
(snipped)
> the file $fmembers looks like this :
> 200112
> 200114
> 200115
> 200119
> 200125
> my script is this :
> the results are :
> '200112
> ''200114
> but the results must be:
> '200112'
> '200114'
A presumption is made your last line data entry
has a trailing newline character.
Godzilla!
--
TEST SCRIPT:
____________
#!perl
print "Content-type: text/plain\n\n";
while (<DATA>)
{
substr ($_, -1, 1, "'\n");
print "'$_";
}
__DATA__
200112
200114
200115
200119
200125
PRINTED RESULTS:
_______________
'200112'
'200114'
'200115'
'200119'
'200125'
------------------------------
Date: Sat, 24 Nov 2001 17:19:29 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: file problem...
Message-Id: <x7vgg09jc0.fsf@home.sysarch.com>
>>>>> "M" == Mark <admin@asarian-host.net> writes:
M> foreach (@members) {
M> print "\'$_\'\n";
M> }
no need for the \. the whole point of using different quote chars is so
you don't have to escape the other quote chars.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
-- Stem is an Open Source Network Development Toolkit and Application Suite -
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Sat, 24 Nov 2001 10:01:09 -0500
From: "MisterSoftware" <moodie@fast.net>
Subject: Re: modify arguments in a sub / function...
Message-Id: <tvvdiqo0in9p46@corp.supernews.com>
Excellent. I think I'm beginning to grasp that. I'll try it.
------------------------------
Date: Sat, 24 Nov 2001 10:03:15 -0500
From: "MisterSoftware" <moodie@fast.net>
Subject: Re: modify arguments in a sub / function...
Message-Id: <tvvdm9nldd56b7@corp.supernews.com>
Thanks - I'm off to there now!
And that's a "no" on the ActiveState Perl - I'm running "PerlWindows",
several years old, to develop scripts for a web page.
I get things working on the PC before I move it to the server - I have ftp
access only on the server...
------------------------------
Date: Sat, 24 Nov 2001 10:32:50 -0500
From: "MisterSoftware" <moodie@fast.net>
Subject: Re: modify arguments in a sub / function...
Message-Id: <tvvfdr6i66aj5c@corp.supernews.com>
Again, thanks. I've found the docs and the world is right. All my
questions have been answered. Now I can become -dangerous-.
> "perl -v" yields:
-----------------------
Win32 port Copyright (c) 1995-1996 Microsoft Corporation.
All rights reserved.
Developed by ActiveWare Internet Corp., http://www.ActiveWare.com
Perl for Win32 Build 316 - Built 09:44:44 Mar 13 1998
This is perl, version 5.003_07
Copyright 1987-1996, Larry Wall
+ suidperl security patch
Perl may be copied only under the terms of either the Artistic License or
the
GNU General Public License, which may be found in the Perl 5.0 source kit.
-----------------------
I use this version because it's command line and I hate the overhead of a
windowed app on my old 200 mhz machine. This runs very well there.
I'll try to be more obstrictificactorian. (I made that last one up...)
------------------------------
Date: Sat, 24 Nov 2001 07:46:44 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: modify arguments in a sub / function...
Message-Id: <3BFFC0E4.17DA69F5@vpservices.com>
MisterSoftware wrote:
>
> "perl -v" yields:
> -----------------------
> Win32 port Copyright (c) 1995-1996 Microsoft Corporation.
> All rights reserved.
> Developed by ActiveWare Internet Corp., http://www.ActiveWare.com
>
> Perl for Win32 Build 316 - Built 09:44:44 Mar 13 1998
>
> This is perl, version 5.003_07
>
> Copyright 1987-1996, Larry Wall
I *strongly* advise you to get a better version of perl for windows.
That is something like five years old and there has been much progress
in both perl (now up to version 5.6.x) and in the specific port of perl
to windows (now, unlike the one you are using, much closer to other
forms of perl). Go to www.activestate.com and get their latest version,
it is much much better than the one you are using.
> I use this version because it's command line and I hate the overhead of a
> windowed app on my old 200 mhz machine.
The activeState version of perl for windows runs fine for most purposes
from the command line.
--
Jeff
------------------------------
Date: Sat, 24 Nov 2001 10:05:46 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: modify arguments in a sub / function...
Message-Id: <3BFFE17A.DD0F4DF1@stomp.stomp.tokyo>
MisterSoftware wrote:
(snipped)
> Again, thanks. I've found the docs and the world is right. All my
> questions have been answered. Now I can become -dangerous-.
You won't become dangerous until you have developed sufficient
Perl skills to be truly labeled a Perl Heretic as I am.
Work at this. Being a Perl Heretic is certainly a greater
honor than being considered Just Another Perl 5 Cargo Cultist.
Godzilla!
------------------------------
Date: Sat, 24 Nov 2001 17:13:38 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Perl Programmer Needed to modify shopping cart
Message-Id: <x71yioay67.fsf@home.sysarch.com>
do you have any brains at all? posting 3k of code is not going to get
you any help. i should charge you $1k just for the insult of downloading
this. and this is not a place to hire perl hackers, use a newsgroup with
'jobs' in the subject.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
-- Stem is an Open Source Network Development Toolkit and Application Suite -
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: 24 Nov 2001 15:22:46 GMT
From: gminick@hacker.pl (Wojtek Walczak)
Subject: Re: question for array operation
Message-Id: <slrn9vvb4e.1a8.gminick@hannibal.localdomain>
Dnia Sat, 24 Nov 2001 13:29:56 +0100, Laocoon napisa³(a):
>Why don't you just read it ?
>@array = qw(cat dog bird);
>delete $array[2];
>print @array; # prints catdog
it works just as
$array[2]="";
so @array is now equal to (cat, "", bird) and not to
(cat, bird)
--
[ Wojtek gminick Walczak ][ http://hacker.pl/gminick/ ]
[ gminick (at) hacker.pl ][ gminick (at) klub.chip.pl ]
------------------------------
Date: Sat, 24 Nov 2001 16:35:18 +0100
From: Laocoon <Laocoon@eudoramail.com>
Subject: Re: question for array operation
Message-Id: <Xns9163A8D384882Laocooneudoramailcom@62.153.159.134>
gminick@hacker.pl (Wojtek Walczak) wrote in
news:slrn9vvb4e.1a8.gminick@hannibal.localdomain:
> Dnia Sat, 24 Nov 2001 13:29:56 +0100, Laocoon napisa³(a):
>>Why don't you just read it ?
>>@array = qw(cat dog bird);
>>delete $array[2];
>>print @array; # prints catdog
> it works just as
> $array[2]="";
> so @array is now equal to (cat, "", bird) and not to
> (cat, bird)
bird is removed so its (cat,dog,'')... but i see your point..
splice(@array,2);
Lao
------------------------------
Date: Sat, 24 Nov 2001 15:39:43 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: question for array operation
Message-Id: <3bffbf3e.41c9$1db@news.op.net>
In article <9to18j$k9a$1@eng-ser1.erg.cuhk.edu.hk>,
Kit <hkyeung9@ie.cuhk.edu.hk> wrote:
>Dears,
> I want to ask if i can delete a element in a array?
>eg.@abc=(cat,dog,chicken). Can i use any function to delete "dog" so that
>@abc=(cat,chicken)?
>Thanks.
You want to use 'splice'.
As you pointed out, 'delete' is only for hashes.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Sat, 24 Nov 2001 08:39:47 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: question for array operation
Message-Id: <3BFFCD53.EEF91BF1@stomp.stomp.tokyo>
Kit wrote:
> Dears,
There are no Sissified Geeks here whom consider me a dear.
> I want to ask if i can delete a element in a array?
So ask.
> eg.@abc=(cat,dog,chicken).
> Can i use any function to delete "dog" so that
> @abc=(cat,chicken)?
Below my signature you will find two methods. My first
method can be used when your element position of your
word or data to delete is unknown. This first method
will delete multiple matching elements.
Second method can be used when your element position
of your word or data to delete is known. This method
will not delete multiple matching elements.
Godzilla!
--
"Do not pay any attention to what Godzilla says. It is a troll,
and has no decent working knowledge of Perl or programming in
general. Search groups.google.com to see a history of its posts
and replies to these posts."
- The CLPM Troll
TEST SCRIPT:
____________
#!perl
print "Content-type: text/plain\n\n";
print "Unknown Position:\n\n";
$delete_word = "dog";
@Array = qw (cat dog chicken lizard catfish dog t-rex);
$position = 0;
for (@Array)
{
if ($_ eq $delete_word)
{ splice (@Array, $position, 1); }
$position++;
}
print "@Array";
print "\n\nKnown Position:\n\n";
@Array = qw (cat dog chicken lizard catfish dog t-rex);
splice (@Array, 1, 1);
print "@Array";
exit;
PRINTED RESULTS:
________________
Unknown Position:
cat chicken lizard catfish t-rex
Known Position:
cat chicken lizard catfish dog t-rex
------------------------------
Date: Sat, 24 Nov 2001 09:10:24 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: question for array operation
Message-Id: <3BFFD480.6696F154@stomp.stomp.tokyo>
Kit wrote:
(snipped)
> eg.@abc=(cat,dog,chicken).
Regarding an issue separate from my first article,
your choice of array format is not all that wise.
Research and read about array formats, specifically
alphabetical characters versus numerical characters.
Godzilla!
--
TEST SCRIPT:
____________
#!perl
@abc = (cat, dog, chicken, t-rex);
for (@abc)
{ print "$_\n"; }
exit;
PRINTED RESULTS:
________________
cat
dog
chicken
0
------------------------------
Date: 24 Nov 2001 18:02:34 GMT
From: blstone77@aol.com (Blstone77)
Subject: Question on substitution
Message-Id: <20011124130234.29596.00001560@mb-fv.aol.com>
s/&//;
I am having a problem in finding a way to eliminate the first instance in a
string, while leaving any other instances. For example, in the string
pumpkins&aligators&trains I want to eliminate the first & but keep any other
instances where it is found in the string so that it will then be
pumpkinsaligators&trains. can anyone tell me how I would go about doing that
Thanks for any help/
------------------------------
Date: Sat, 24 Nov 2001 15:34:52 +0100
From: "Steffen Müller" <5l259r001@sneakemail.com>
Subject: Re: signature error (was: Re: Difficulty with references and hashes) ;)
Message-Id: <9tob4a$h4n$06$1@news.t-online.com>
"Wojtek Walczak" <gminick@hacker.pl> schrieb im Newsbeitrag
news:slrn9vuuc9.di.gminick@hannibal.localdomain...
| Dnia Fri, 23 Nov 2001 19:44:23 +0100, Steffen Müller napisal(a):
|
>$_=q;0cb212c210b0bb010c0113bb0c410c0b516c0bb3d212c2b0b0b016b6cb2b2c21010c0
|
>b41110b3bba0e0c0d2c4b2b6bc013d2c0d0b01012b0b0;;s/\n//g;s/(\d)/$1<2?$1:'0'x
| >$1/ge;s/([a-f])/'1'x(ord($1)-97)/ge;$o=$_;push@o,substr($o,$_*8,8)
for(0..
|
>24);for(@o){print"\0"x(26-$i).chr(oct('0b'.($_)))."\r";$i++};print"\n"#stm
| perl5.6.1 & slackware8.0
| somenthing's wrong here, because your signature prints only
| one letter - 'J' ;>
Well, it works great on my 5.6.1 from ActiveState (w2k).
Doesn't run under strict/warnings, though.
Dunno what's wrong.
Steffen
--
$_=q;0cb212c210b0bb010c0113bb0c410c0b516c0bb3d212c2b0b0b016b6cb2b2c21010c0
b41110b3bba0e0c0d2c4b2b6bc013d2c0d0b01012b0b0;;s/\n//g;s/(\d)/$1<2?$1:'0'x
$1/ge;s/([a-f])/'1'x(ord($1)-97)/ge;$o=$_;push@o,substr($o,$_*8,8) for(0..
24);for(@o){print"\0"x(26-$i).chr(oct('0b'.($_)))."\r";$i++};print"\n"#stm
------------------------------
Date: 24 Nov 2001 06:12:21 -0800
From: dmonterrubio@terra.es (BorisVian)
Subject: Uploading Files via CGI.pm
Message-Id: <fb3ce80.0111240612.67742187@posting.google.com>
How can I upload files using CGI from a <FORM>
Thanks
------------------------------
Date: Sat, 24 Nov 2001 17:37:14 +0000
From: Dave Barter <spam@phased.co.uk>
Subject: Re: Uploading Files via CGI.pm
Message-Id: <qZQL7.4476$i37.529222@news6-win.server.ntlworld.com>
BorisVian wrote:
> How can I upload files using CGI from a <FORM>
>
> Thanks
TO CREATE THE FORM:-
use CGI;
$cgi-ob = CGI::new();
print $cgi-ob->filefield('Upload');
TO ACCESS THE DATA:-
if ($file = param('filename')) {
$tmpfile = tmpFileName($file) # gives you access to the uploaded file
......
}
------------------------------
Date: Sat, 24 Nov 2001 19:22:38 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Uploading Files via CGI.pm
Message-Id: <Pine.LNX.4.30.0111241921030.27752-100000@lxplus023.cern.ch>
On Nov 24, BorisVian inscribed on the eternal scroll:
> How can I upload files using CGI from a <FORM>
I did it by following the docs. From the fact that you're asking
here, it would appear that you can't, but you're not telling us where
the problem was with that, so it's hard to give constructive help.
------------------------------
Date: Sat, 24 Nov 2001 18:56:07 GMT
From: "E.Chang" <echang@netstorm.net>
Subject: Re: Uploading Files via CGI.pm
Message-Id: <Xns91638ED7A5296echangnetstormnet@207.106.92.86>
dmonterrubio@terra.es (BorisVian) wrote in
news:fb3ce80.0111240612.67742187@posting.google.com:
> How can I upload files using CGI from a <FORM>
See the file upload examples at
http://stein.cshl.org/WWW/software/CGI/.
--
EBC
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 2196
***************************************