[15780] in Perl-Users-Digest
Perl-Users Digest, Issue: 3193 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 29 06:05:47 2000
Date: Mon, 29 May 2000 03:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <959594710-v9-i3193@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 29 May 2000 Volume: 9 Number: 3193
Today's topics:
Algorythm needed for copying subdirectory hierarchies <makau@multimania.com>
cgi script that lets users post movie and book reviews calderas@my-deja.com
Re: cgi script that lets users post movie and book revi <sammy157@yahoo.com>
Re: cron job and a perl script directory <billy@arnis-bsl.com>
Re: Does this exist? <falkware@home.com>
Re: Does this exist? <s0218327@unix1.cc.ysu.edu>
Re: Looking for a script <none>
Re: Newbie: DIV <SCanisius@dusnet.de>
Re: Newbie: DIV <SCanisius@dusnet.de>
No Flash <laoxiu100@hotmail.com>
Re: Pattern Match this! (Gwyn Judd)
Re: Pattern Match this! <ptimmins@itd.sterling.com>
Re: Pattern Match this! <godzilla@stomp.stomp.tokyo>
Perl constantly-running mioi@my-deja.com
Re: Perl constantly-running amir142@my-deja.com
Re: Perl constantly-running (Steve Leibel)
Re: Perl IDE for Win32? <justin@lolofie.com>
Perl script doesn't run Newbie
Re: Perl script doesn't run <jezebel@netlords.net>
PerLotto v0.1a4 <y-o-y@home.com>
Re: PerLotto v0.1a4 <dave@dave.org.uk>
Re: PGP in Perl? <dave@dave.org.uk>
Re: reading line number <lr@hpl.hp.com>
Re: reading line number <billy@arnis-bsl.com>
Re: seeking method to encode email addresses in web pag (Bart Lateur)
Re: seeking method to encode email addresses in web pag (Bart Lateur)
Re: setting main:: variables from a library file (Neil Kandalgaonkar)
Re: sort routine fails <lr@hpl.hp.com>
Re: Translate foreign characters to English (Lou Hevly)
Re: Waxing Philosophical (Tad McClellan)
Re: Waxing Philosophical <godzilla@stomp.stomp.tokyo>
Re: Waxing Philosophical <dan@tuatha.sidhe.org>
Re: Waxing Philosophical (jason)
Re: Waxing Philosophical (brian d foy)
Re: Waxing Philosophical <dave@dave.org.uk>
Re: Weird script behaviour called from a web page. <sue@pennine.com>
Re: Weird script behaviour called from a web page. ()
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 29 May 2000 09:41:45 GMT
From: Makau Divangamene <makau@multimania.com>
Subject: Algorythm needed for copying subdirectory hierarchies
Message-Id: <8gte0n$4j6$1@nnrp1.deja.com>
I have a subdirectories hierarchy that is so deep that doing a "cp -R"
for a recursive copy doesn't work. Indeed The directory tree is so
complex it can't fit into memory so I always get an "OUT OF MEMORY"
error. This is very crictical because it is for backup purposes ....
So what I want to do is write an algorythm (using Perl) that will copy
the hole directory tree with all its files (recursively) by doing -
basically - a "cd <src/dir>; md <dest/dir>, cp * <dest/dir>, etc ..."
For example with the following directory tree :
/
dir1
dir2
dir3
dir4
dir5
It should do :
cd dir1
mkdir <dest/dir1>
cp * <dest/dir1>
cd dir2
mkdir <dest/dir1/dir2>
cp * <dest/dir1/dir2>
cd dir3
mkdir <dest/dir1/dir2/dir3>
cp * <dest/dir1/dir2/dir3>
cd ..
cd dir4
mkdir <dest/dir1/dir4>
cp * <dest/dir1/dir4>
cd ..
cd dir5
mkdir <dest/dir5>
cp * <dest/dir5>
( that way I wouldn't get an Out Of Memory Error message )
It looks quite easy in the first approach. That's what I thought but as
soon as I started coding, I got into the troubles of local variables
("my"/"local") in "foreach" loops, etc .. And this algorythm is _really_
not easy to do. Actually it's a real challenge for me. Unfortunately I
have to find the solution ....
Hoping someone will be kind enough to help me solve the problem,
A great day to all
--
Charles Henry
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 29 May 2000 08:41:03 GMT
From: calderas@my-deja.com
Subject: cgi script that lets users post movie and book reviews on website?
Message-Id: <8gtaet$2ap$1@nnrp1.deja.com>
I am looking for a free cgi script that lets users post reviews of
things (books, movies) on a website... maybe one that lets the user
write a paragraph review and give a 1-10 rating for instance... anyone
know a good one that will do this?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 29 May 2000 11:13:12 +0200
From: "Saman Rahmanian" <sammy157@yahoo.com>
Subject: Re: cgi script that lets users post movie and book reviews on website?
Message-Id: <393234c4$0$53618@SSP1NO17.highway.telekom.at>
<calderas@my-deja.com> schrieb in im Newsbeitrag:
8gtaet$2ap$1@nnrp1.deja.com...
> I am looking for a free cgi script that lets users post reviews of
> things (books, movies) on a website... maybe one that lets the user
> write a paragraph review and give a 1-10 rating for instance... anyone
> know a good one that will do this?
sorry to be of little help, but have you already looked at
www.cgi-resources.com ?
Saman
------------------------------
Date: Mon, 29 May 2000 08:17:08 GMT
From: Ilja <billy@arnis-bsl.com>
Subject: Re: cron job and a perl script directory
Message-Id: <8gt91t$1a0$1@nnrp1.deja.com>
In article <8got7s$5na$1@nnrp1.deja.com>,
johnqxu@my-deja.com wrote:
> All,
> When a cron job is set to invoke a perl script under other directory,
> is there any way to find current directory that the perl script
located
> within this perl script?
>
A path to perl script which is running _maybe_ can be found
in $0 variable. (IMHO in Unix cron job it will be OK).
Then the content of $0 may be parsed by hand or better by
File::Basename module.
But I suggest you to redesign you script. AFAIK, on Unix
$0 (or argv[0] in C) is very seldom (if at all) used
for critical purposes (like data and/or configuration files
location).
Good luck.
Ilja.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 29 May 2000 05:47:17 GMT
From: Falk <falkware@home.com>
Subject: Re: Does this exist?
Message-Id: <g114js44tt2d7cr4im5263nqnj6e02qp5n@4ax.com>
Reply to: Dave Cross <dave@dave.org.uk>
Subject: Re: Does this exist?
Date: Sat, 27 May 2000 13:00:10 +0100
Newsgroup(s): comp.lang.perl.misc
Lines: 38
Original text:
>
>This sounds like a question which would be more at home in
>comp.infosystems.www.authoring.cgi. Did you ask over there?
Yeah, I've tried to post there several times, with different issues,
but none of my posts appear in that newsgroup, and I don't know why...
I apologize if I posted in the wrong newsgroup...
--
#!/user/Falk
#!/Falkware dot com: http://www.falkware.com
#!/FDC BBS: http://www.falkware.com/fdcbbs/
#!/Visit http://www.shoppersanonymous.net
------------------------------
Date: Mon, 29 May 2000 02:34:55 -0400
From: NagaPutih <s0218327@unix1.cc.ysu.edu>
Subject: Re: Does this exist?
Message-Id: <Pine.A41.4.20.0005290229480.53164-100000@unix1.cc.ysu.edu>
On Mon, 29 May 2000, Falk wrote:
> Yeah, I've tried to post there several times, with different issues,
> but none of my posts appear in that newsgroup, and I don't know why...
if it was your first post, you'll get e-mail which you have to reply
to approve yourself to post.
if it isn't, and i assume you haven't approved yourself, start your
posting by putting "passme" on the first line by itself.
however, you may want to check the following url before posting:
http://www.boutell.com/openfaq/cgi
hope this helps.
------------------------------
Date: Mon, 29 May 2000 04:38:24 -0500
From: "Al" <none>
Subject: Re: Looking for a script
Message-Id: <sj4epm255pj63@corp.supernews.com>
If you want to hire someone to write it for you, then drop be a line.
al@alaweb.com
Manel wrote in message ...
>Hi newsusers.
>I'm looking for a script to create a job center.
>If anybody knoks about it please send an email to webmaster@fotowebs.com
>
>Thanks
>
>
------------------------------
Date: Mon, 29 May 2000 06:31:58 +0200
From: Stephan Canisius <SCanisius@dusnet.de>
Subject: Re: Newbie: DIV
Message-Id: <3931F2BE.2E55985C@dusnet.de>
Hi Joakim!
Thanks! Thanks! Thanks! That's exactly what I need!!!!!!!
Stephan
Joakim Hove wrote:
> Well, i guess int () should help you with this. However you should be
> aware that int truncates decimals, and does not do mathematically
> proper rounding:
>
> #!/usr/bin/perl -w
> $three = int 10/3;
> $four = int 19/4;
>
> Joakim
> ===========================================
------------------------------
Date: Mon, 29 May 2000 06:33:35 +0200
From: Stephan Canisius <SCanisius@dusnet.de>
Subject: Re: Newbie: DIV
Message-Id: <3931F31F.4BE7B44C@dusnet.de>
Hi guys!
Thanks for all your help, I found out here, what I needed!
Thanks again!!!!
Stephan
Stephan Canisius wrote:
> Hi Guys!
>
> Cal anyone tell me, how i can do a DIV in Perl 5.???
>
> A function which gives me back a "3" if I give it 10 and 3.
>
> 10/3 is 3.333333333 and I only want the 3 given to me.
>
> Thanks
>
> Stephan
------------------------------
Date: Mon, 29 May 2000 16:24:06 +0900
From: "sang" <laoxiu100@hotmail.com>
Subject: No Flash
Message-Id: <8gt5ld$a8l$1@nn-os105.ocn.ad.jp>
Hi,alls
I am developing a chat room code.
I use client pull to refresh chat html.
But i don't like the flash, is there any
way to avoid flash of chat html?
Thanks in advance
------------------------------
Date: Mon, 29 May 2000 04:06:11 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Pattern Match this!
Message-Id: <slrn8j3ra3.4qp.tjla@thislove.dyndns.org>
I was shocked! How could Gwyn Judd <tjla@guvfybir.qlaqaf.bet>
say such a terrible thing:
>I was shocked! How could Amri, Kuross [WOLL:4009-I:EXCH] <kamri@asiapacificm01.nt.com>
>say such a terrible thing:
>>G'day,
>>
>>I have a string in a data file that isn't being picked up through pattern
>>matching. The strings look something like this
>>
>>AV90300 && 34
>>or AT70546B&&145
>>
>>There are between 7 or 8 letters that identify the string, then a separator
>>of a double ampersand and then up to 3 numbers. How would you do this. I am
>>currently doing something like...
>>
>> /$identifier&&(\d{3})\n/
>>
>>any thoughts?
>
>Well it looks like you have some space (possibly) between the identifier
>and the ampersands and the numbers. Also \d{3} will match exactly 3
>digits (not up to three). so:
>
>/$identifier\s+(\d{0,3})\n/
ack. I could have told you that code was untested. try this:
/$identifier\s*&&\s*(\d{0,3})\n/
--
Gwyn Judd (tjla@guvfybir.qlaqaf.bet)
My return address is rot13'ed
Behold the warranty -- the bold print giveth and the fine print taketh away.
------------------------------
Date: Mon, 29 May 2000 04:28:13 GMT
From: Patrick Timmins <ptimmins@itd.sterling.com>
Subject: Re: Pattern Match this!
Message-Id: <8gsrkh$nhu$1@nnrp1.deja.com>
In article <8gsjlm$qv8$1@bcrkh13.ca.nortel.com>,
"Amri, Kuross [WOLL:4009-I:EXCH]" <kamri@asiapacificm01.nt.com> wrote:
> G'day,
>
> I have a string in a data file that isn't being picked up through
pattern
> matching. The strings look something like this
>
> AV90300 && 34
> or AT70546B&&145
>
> There are between 7 or 8 letters that identify the string, then a
separator
> of a double ampersand and then up to 3 numbers. How would you do this.
$identifier = 'AT70546B'; # or whatever
while (<DATA>) {
chomp;
/$identifier ?&& ? ?\d?\d?\d?/ && print "$_ matched $identifier\n";
}
__DATA__
AV90300 && 34
AT70546B&&145
HTH
Pat
--
$monger{Omaha}[0]
Patrick Timmins
ptimmins@itd.sterling.com
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sun, 28 May 2000 21:48:32 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Pattern Match this!
Message-Id: <3931F6A0.2B940135@stomp.stomp.tokyo>
"Amri, Kuross [WOLL:4009-I:EXCH]" wrote:
> I have a string in a data file that isn't being
> picked up through pattern matching. The strings
> look something like this
> AV90300 && 34
> or AT70546B&&145
> There are between 7 or 8 letters that identify
> the string, then a separator of a double ampersand
> and then up to 3 numbers. How would you do this. I am
> currently doing something like...
> /$identifier&&(\d{3})\n/
> any thoughts?
TEST SCRIPT
___________
#!/usr/local/bin/perl
print "Content-Type: text/plain\n\n";
$input = "AV90300 && 34
AT70546B&&145";
print "Input Is: $input \n\n";
@Array = split (/\n/, $input);
print "Output Is: \n\n";
foreach $line (@Array)
{
$line =~ s/ //g;
local ($var1, $var2) = split (/&&/, $line);
print "Variable 1: $var1 Variable 2: $var2 \n";
}
print "
Godzilla!";
exit;
PRINTED RESULTS
_______________
Input Is: AV90300 && 34
AT70546B&&145
Output Is:
Variable 1: AV90300 Variable 2: 34
Variable 1: AT70546B Variable 2: 145
Godzilla!
------------------------------
Date: Mon, 29 May 2000 05:03:09 GMT
From: mioi@my-deja.com
Subject: Perl constantly-running
Message-Id: <8gstm8$p0h$1@nnrp1.deja.com>
Hi. I'm new to Perl, and I've always known it to be the type of
programming language where you run it, it does its job, and it quits.
but my latest task requires that i have a perl script grabbing a web
page every 10 seconds or so and storing it onto a file. all i need to
know is how i will keep this perl script constantly running and perform
its task every 10 seconds.. can someone please let me know? thanks!
sincerely,
~mioi
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 29 May 2000 05:15:47 GMT
From: amir142@my-deja.com
Subject: Re: Perl constantly-running
Message-Id: <8gsudq$pf4$1@nnrp1.deja.com>
Check out this code:
#!/usr/bin/perl
use strict;
use POSIX qw(setsid);
use LWP::Simple;
$| = 1; # flush the buffer
&daemonize; # daemonize the program
# our infinite loop
while(1) {
# do your stuff
sleep(10); # wait for 10 seconds
}
sub daemonize {
chdir '/' or die "Can't chdir to /: $!";
open STDIN, '/dev/null' or die "Can't read /dev/null: $!";
open STDOUT, '>>/dev/null' or die "Can't write to /dev/null: $!";
open STDERR, '>>/dev/null' or die "Can't write to /dev/null: $!";
defined(my $pid = fork) or die "Can't fork: $!";
exit if $pid;
setsid or die "Can't start a new session: $!";
umask 0;
}
Hope it works...
Amir
In article <8gstm8$p0h$1@nnrp1.deja.com>,
mioi@my-deja.com wrote:
> Hi. I'm new to Perl, and I've always known it to be the type of
> programming language where you run it, it does its job, and it quits.
> but my latest task requires that i have a perl script grabbing a web
> page every 10 seconds or so and storing it onto a file. all i need to
> know is how i will keep this perl script constantly running and
perform
> its task every 10 seconds.. can someone please let me know? thanks!
>
> sincerely,
> ~mioi
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 29 May 2000 01:11:24 -0700
From: stevel@coastside.net (Steve Leibel)
Subject: Re: Perl constantly-running
Message-Id: <stevel-2905000111530001@192.168.100.2>
In article <8gstm8$p0h$1@nnrp1.deja.com>, mioi@my-deja.com wrote:
> Hi. I'm new to Perl, and I've always known it to be the type of
> programming language where you run it, it does its job, and it quits.
> but my latest task requires that i have a perl script grabbing a web
> page every 10 seconds or so and storing it onto a file. all i need to
> know is how i will keep this perl script constantly running and perform
> its task every 10 seconds.. can someone please let me know? thanks!
>
Well here's a script that does just that:
while (1) {
sleep(10);
do_something_interesting();
}
Now all you have to do is write the do_something_interesting() subroutine
and you're all set!
Steve L
------------------------------
Date: Sun, 28 May 2000 22:52:07 -0700
From: "Justin" <justin@lolofie.com>
Subject: Re: Perl IDE for Win32?
Message-Id: <sj41a7gg5pj140@corp.supernews.com>
There is Perl Builder...I don't recommend it, but it does exist at:
http://www.solutionsoft.com/perl.htm
If you are trying to create a graphical interface, you can use SpecTcl- but
it doesn't exactly fit your "solid" specification:
http://dev.scriptics.com/software/spectcl/
There is code warrior, I've never tried it but I heard it sucks *really* bad
and is overpriced, so you might try that...
http://www.metrowerks.com/advert/007/features/
Oh, and there is this oddity that I never knew existed...
http://linux.ece.uci.edu/~wangy/VisualPerl/vperl.html
The answer to your question, in case you haven't guessed yet, is "NO", there
is no solid "Visual Perl". All you can do is bend over and cross your
fingers like the rest of us and hope Visual Studio 7 is all that it is being
marketted to be:
http://www.activestate.com/Corporate/Media_Center/News/Press959117519.html
<osiris@mindless.com> wrote in message news:8gsjf7$iab$1@nnrp1.deja.com...
> Hi All,
> I know this must have hashed over more times than *replace with
> something well hashed over* but has anyone got any recommendations for
> a solid Perl IDE under Win32? Preferably it would have syntax coloring
> and integrated FTP support (with symlink support). TIA.
>
> Matt.
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: 29 May 2000 06:15:10 GMT
From: Newbie
Subject: Perl script doesn't run
Message-Id: <8gt1te010l8@news1.newsguy.com>
I have a simple 'Hello world' script called test.pl that won't run. It's in the /home/httpd/cgi-bin directory. All directories are owned by root, I'm logged in as root, and the file permissions on the script are 755. It looks like:
#!/usr/bin/perl
print "Hello world\n";
A 'which perl' returns /usr/bin/perl.
If I run it on the command line like 'perl test.pl', it runs fine. If I run it like './test.pl' or 'test.pl', I get a message that says "bash: /home/httpd/cgi-bin/test.pl: No such file or directory". I've tried all sorts of things. I can run shell scripts from the same directory with the same permissions, etc. What gives?
==================================
Posted via http://nodevice.com
Linux Programmer's Site
------------------------------
Date: Mon, 29 May 2000 11:19:18 +0200
From: "Jezebel" <jezebel@netlords.net>
Subject: Re: Perl script doesn't run
Message-Id: <3932355e@post.newsfeeds.com>
*** post for free via your newsreader at post.newsfeeds.com ***
<Newbie> wrote in message news:8gt1te010l8@news1.newsguy.com...
>
> I have a simple 'Hello world' script called test.pl that won't run. It's
in the /home/httpd/cgi-bin directory. All directories are owned by root, I'm
logged in as root, and the file permissions on the script are 755. It looks
like:
>
> #!/usr/bin/perl
> print "Hello world\n";
>
> A 'which perl' returns /usr/bin/perl.
>
> If I run it on the command line like 'perl test.pl', it runs fine. If I
run it like './test.pl' or 'test.pl', I get a message that says "bash:
/home/httpd/cgi-bin/test.pl: No such file or directory". I've tried all
sorts of things. I can run shell scripts from the same directory with the
same permissions, etc. What gives?
>
> ==================================
> Posted via http://nodevice.com
> Linux Programmer's Site
You have to include a http header first, before you can make it run as a
CGI.
It looks like:
print "Content-Type:text/htm\n\n";
Also, don't forget to check httpd.conf. If you want the server to treat .pl
files as .cgi's you have to say so, assuming you run Apache for web server.
When you are done, don't forget to set chmod a+rx on your script to make it
executable.
This is a good place to start looking for more detailed information how to
write your own CGI's.
http://www.cgi101.com/class/
regards Jezebel
**** Post for FREE via your newsreader at post.newsfeeds.com ****
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*** Newsfeeds.com - The #1 Usenet Newsgroup Service on The Planet! ***
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
http://www.newsfeeds.com | http://www.newsfeeds.com
|
* Anonymous posting server! | * Totally Uncensored!
* SUPER Servers! | * Over 80,000 Newsgroups!
* BINARIES ONLY Servers! | * 16 seperate Newsgroup Servers!
* SPAM FILTERED Server! | * Instant access!
* ADULT ONLY Server! | * Multiple OC 3's and OC 12's!
* MP3 ONLY Server! | * 99% Article Completion!
* MULTIMEDIA ONLY Server! | * Months of Retention!
* 7 UNCENSORED Newsgroup Servers | * Lightning FAST downloads!
|
http://www.newsfeeds.com | http://www.newsfeeds.com
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
**** Point your newsreader to post.newsfeeds.com ****
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
------------------------------
Date: Mon, 29 May 2000 04:43:30 GMT
From: Andy <y-o-y@home.com>
Subject: PerLotto v0.1a4
Message-Id: <SzmY4.214880$Tn4.1930883@news1.rdc2.pa.home.com>
# PerLotto 0.1a4 My first "real" Perl script.
# May 29, 2000 by Andy Burns
#
# Lotto games checker
#
# PerLotto expects a text file "games".
# Formatted similarly:
#/Andy's ticket
#01 02 03 04 05 06
#01 02 03 04 05 07
#01 02 03 04 07 08
#01 02 03 07 08 09
#01 02 07 08 09 10
#01 07 08 09 10 11
#07 08 09 10 11 12
#
#/Lynn's ticket
#01 04 05 10 24 25
#03 04 23 33 38 41
#03 16 58 60 67 68
#15 21 25 51 58 61
#40 46 50 52 55 57
# end of example.
#
# History:
#
# May 29, 2000
# ...and we too shall follow and reunite with brave men.
#
# Version 0.1a4: Bummed code.
# More Gywn help learned and adopted.
# Re-cased "HITS" to "Hit"
# Used $_ where possible. (?)
# Historied missing v0.1a3 @winners sort/print stuff.
# Still to do: print alignment and plenty of other stuff.
#
# May 27, 2000
# Version 0.1a3: Incorporated as much Gwyn help as I understood.
# Added "Hits" to final output.
# Attempted to improve style.
# Still to do: print alignment and plenty of other stuff.
# Spent a lot of time reading Perl Doc.
#
# May 26, 2000
# Version 0.1a2: (UNRELEASED)
# Fixed typos and block indenting.
# Added Error check for non-digits in games.
# Changed array name @lotto to @winners for sensibility.
# Changed array name @wins to @game for sensibility.
# Changed main 'for' to 'foreach'
# Allowed comment lines '/' and blank lines in 'games'
file.
#
# May 25, 2000
# Version 0.1a1: Initial release
print("Enter winning numbers separated by spaces: ");
chop($input = <STDIN>);
@winners = (split ' ', $input);
@winners = sort {$a <=> $b} @winners;
print"Winning numbers: @winners\n\n";
open(IN, 'games');
##open(STDOUT, '>gameslog');
while (<IN>) {
if (/^\//|/^$/) {
print "$_";
next;
}
chomp;
@game = split;
$picks = 0;
undef @picked;
## Check for duplicate numbers in a game
L: for (my $i = 0; $i < @game; $i++) {
for (my $j = $i + 1; $j < @game; $j++) {
if ($game[$i] == $game[$j]) {
print "ALERT: Duplicate number \"$game[$i]\" in game
below.\n";
last L;
}
}
}
## Check for non-digit in game
foreach (@game) {
print "ALERT: Non-numeric entry \"$_\" in game below.\n" if /\D/;
}
## Check for correct number of entries per game
print "ALERT: Too few numbers in game below.\n" if @game < @winners;
print "ALERT: Too many numbers in game below.\n" if @game > @winners;
## Main
foreach my $y (@winners) {
for my $x (@game) {
if ($y == $x) {
$picks++;
push @picked, $x;
}
}
}
print "@game";
print " --$picks";
if ($#picked > -1) {
print " Hit: @picked\n";
} else {
print "\n";
}
}
Andy
------------------------------
Date: Mon, 29 May 2000 10:47:50 +0100
From: Dave Cross <dave@dave.org.uk>
Subject: Re: PerLotto v0.1a4
Message-Id: <3be4jssqa5cc3fuo1nok597d3fcvoabn3o@4ax.com>
I assume you're posting this for peer review, so I hope you don't mind
if I jump in with a few suggestions...
On Mon, 29 May 2000 04:43:30 GMT, Andy <y-o-y@home.com> wrote:
># PerLotto 0.1a4 My first "real" Perl script.
># May 29, 2000 by Andy Burns
>#
># Lotto games checker
>#
># PerLotto expects a text file "games".
># Formatted similarly:
>
>#/Andy's ticket
>#01 02 03 04 05 06
>#01 02 03 04 05 07
>#01 02 03 04 07 08
>#01 02 03 07 08 09
>#01 02 07 08 09 10
>#01 07 08 09 10 11
>#07 08 09 10 11 12
>#
>#/Lynn's ticket
>#01 04 05 10 24 25
>#03 04 23 33 38 41
>#03 16 58 60 67 68
>#15 21 25 51 58 61
>#40 46 50 52 55 57
># end of example.
>#
># History:
>#
># May 29, 2000
># ...and we too shall follow and reunite with brave men.
>#
># Version 0.1a4: Bummed code.
># More Gywn help learned and adopted.
># Re-cased "HITS" to "Hit"
># Used $_ where possible. (?)
># Historied missing v0.1a3 @winners sort/print stuff.
># Still to do: print alignment and plenty of other stuff.
>#
># May 27, 2000
># Version 0.1a3: Incorporated as much Gwyn help as I understood.
># Added "Hits" to final output.
># Attempted to improve style.
># Still to do: print alignment and plenty of other stuff.
># Spent a lot of time reading Perl Doc.
>#
># May 26, 2000
># Version 0.1a2: (UNRELEASED)
># Fixed typos and block indenting.
># Added Error check for non-digits in games.
># Changed array name @lotto to @winners for sensibility.
># Changed array name @wins to @game for sensibility.
># Changed main 'for' to 'foreach'
># Allowed comment lines '/' and blank lines in 'games'
>file.
>#
># May 25, 2000
># Version 0.1a1: Initial release
Really picky one here. The string in the line below is constant,
therefore there is not need for the double quotes.
print('Enter winning numbers separated by spaces: ");
>print("Enter winning numbers separated by spaces: ");
'chomp' is safer than 'chop' here
chomp($input = <STDIN>);
>chop($input = <STDIN>);
>@winners = (split ' ', $input);
$a <=> $b is the default sort algorithm, so you don't need to specify
it here
@winners = sort @winners;
>@winners = sort {$a <=> $b} @winners;
>print"Winning numbers: @winners\n\n";
Should check for succcess of the open here
open(IN, 'games') or die "Can't open 'games' file: $!\n";
>open(IN, 'games');
>##open(STDOUT, '>gameslog');
>
>while (<IN>) {
> if (/^\//|/^$/) {
print uses the contents of $_ by default so you don't need to specify
it explicitely here
print;
> print "$_";
> next;
> }
>
> chomp;
> @game = split;
> $picks = 0;
> undef @picked;
>
>## Check for duplicate numbers in a game
Personally I'd rewrite these loops to be more 'Perlish'. The for (;;)
is very rarely used in Perl.
foreach my $i (0 .. $#game) {
foreach my $j ($i + 1 .. $#game) {
>L: for (my $i = 0; $i < @game; $i++) {
> for (my $j = $i + 1; $j < @game; $j++) {
> if ($game[$i] == $game[$j]) {
There's no need to escape those quotes in this print statement. Either
switch to using qingle quotes
print "ALERT: Duplicate number '$game[$i]' in game below.\n";
or use the qq// operator for custom "double quotes"
print qq/ALERT: Duplicate number "$game[$i]" in game below.\n/;
> print "ALERT: Duplicate number \"$game[$i]\" in game below.\n";
> last L;
> }
> }
> }
>
>## Check for non-digit in game
>
> foreach (@game) {
Same thing with double quotes here...
> print "ALERT: Non-numeric entry \"$_\" in game below.\n" if /\D/;
> }
>
>## Check for correct number of entries per game
>
> print "ALERT: Too few numbers in game below.\n" if @game < @winners;
> print "ALERT: Too many numbers in game below.\n" if @game > @winners;
>
>## Main
> foreach my $y (@winners) {
> for my $x (@game) {
> if ($y == $x) {
> $picks++;
> push @picked, $x;
> }
> }
> }
Any reason why these next two lines are separated? I'd use
print "@game -- $picks";
> print "@game";
> print " --$picks";
A stylistic issue here, I'd be more tempted to write
print " Hit: @picked" if @picked;
print "\n";
> if ($#picked > -1) {
> print " Hit: @picked\n";
> } else {
> print "\n";
> }
>}
I hope you find this useful.
Cheers,
Dave...
--
<http://www.dave.org.uk> SMS: sms@dave.org.uk
yapc::Europe - London, 22 - 24 Sep <http://www.yapc.org/Europe/>
"There ain't half been some clever bastards" - Ian Dury [RIP]
------------------------------
Date: Mon, 29 May 2000 10:30:16 +0100
From: Dave Cross <dave@dave.org.uk>
Subject: Re: PGP in Perl?
Message-Id: <h1e4js84sbtkmgmrun07gbb21hjou7h7v4@4ax.com>
On Mon, 29 May 2000 02:16:44 GMT, bing-du@tamu.edu wrote:
>Greetings...
>
>I'm wondering how to do encryption using PGP in Perl? Any functions,
>modules, libraries or...? It would be great if there is online
>documents on this.
>
>Any help would be greatly appreciated.
Best way to answer a question like this is to head over to
<http://search.pcan.org> and look for modules with "PGP" in their
name... oh look there's one called Crypt-PGP which is described as "A
module for accessing PGP 5 functionality." How does that sound?
hth,
Dave...
--
<http://www.dave.org.uk> SMS: sms@dave.org.uk
yapc::Europe - London, 22 - 24 Sep <http://www.yapc.org/Europe/>
"There ain't half been some clever bastards" - Ian Dury [RIP]
------------------------------
Date: Sun, 28 May 2000 23:32:38 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: reading line number
Message-Id: <MPG.139baed586713fab98aafd@nntp.hpl.hp.com>
In article <vx8Y4.7149$c5.10613@newsfeeds.bigpond.com>,
wes_hutton@hotmail.com says...
> I am trying to store the current line number of the file that I have open,
> the command printf ("%1d", $.) prints the correct line number - is there any
> way to redirect this number to a variable, ie $cur_line = `printf ("%1d",
> $.)`, or is there a different command I can use?
You could use sprintf instead of printf, but why? The '%1d' conversion
does nothing. Just try this:
$cur_line = $.;
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 29 May 2000 09:29:28 GMT
From: Ilja <billy@arnis-bsl.com>
Subject: Re: reading line number
Message-Id: <8gtd9e$44b$1@nnrp1.deja.com>
In article <vx8Y4.7149$c5.10613@newsfeeds.bigpond.com>,
"wes" <wes_hutton@hotmail.com> wrote:
> I am trying to store the current line number of the file that I have open,
> the command printf ("%1d", $.) prints the correct line number - is there any
> way to redirect this number to a variable, ie $cur_line = `printf ("%1d",
> $.)`, or is there a different command I can use?
>
Why do you need printf at all ?
$. is just a variable, so use assignment.
$my_line_number = $.;
Ilja.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 29 May 2000 07:22:44 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: seeking method to encode email addresses in web page forms
Message-Id: <39331747.4516812@news.skynet.be>
Bob Reap wrote:
>I have a simple Perl chatboard I've created and I noticed that the email
>addresses are getting farmed by spammers. I've put up wPoison, but to
>really protect the users' privacy I want to switch to a system where all
>email is sent to the original poster via a form resident on my site.
>
>My question: is there an easy way to encode the email addresses in the
>chatboard script so that my mail-to-poster form can just as easily
>decode the address, yet keep most spider's and curious (and clever)
>folks from figuring out what the email address is?
Do you have to keep the addresses on the page? I'd give people a
(unique) user name, and keep a little database file on your site, which
serves to look up the address from the user name when mailing the form.
--
Bart.
------------------------------
Date: Mon, 29 May 2000 07:22:46 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: seeking method to encode email addresses in web page forms
Message-Id: <3934184e.4779628@news.skynet.be>
Godzilla! wrote:
>> It's far easier using 'pack' and 'unpack'.
>
>
>=~ s/%(..)/pack("c",hex($1))/ge;
>
>=~ s/([0-9A-Fa-f]{2})/ sprintf("%c",hex($1)) /ge ;
>
>Which is best and why?
Duh....
s/([0-9A-Fa-f]{2})/chr hex $1/ge;
Oh, that's right, you don't do Perl5.
Actually, I think Dave Cross wanted to point you to the 'H' template:
s/([0-9A-Fa-f]{2})/pack 'H2', $1/ge;
No hex().
--
Bart.
------------------------------
Date: 29 May 2000 05:41:09 GMT
From: nj_kanda@alcor.concordia.ca (Neil Kandalgaonkar)
Subject: Re: setting main:: variables from a library file
Message-Id: <8gsvtl$rnm$1@newsflash.concordia.ca>
In article <3931908e$0$12967@reader3>, Seansan <sean77@dds.nl> wrote:
>I created a library file for POST and GET requests that sets a hash variable
>for the main (calling) program. I now use refernces to pass a handle.
>Now I want to set a variable that is local for the main:: environment.
>
>How do I do this from a module / library file ??
This depends on what you mean by 'local'. Perl has package variables,
which can occasionally take on temporary local values, and lexical
variables, which are inaccessible from any other scope.
<http://www.plover.com/~mjd/perl/FAQs/Namespaces.html>
The caller() function might be what you're looking for, too.
You should be aware that in most cases, it's terrible style for a
library or module to have unobvious effects in the caller's package,
like setting variables. When you do that, you're obliterating the
chief virtues of having a library or module. It immediately
becomes less safe, portable, reusable, and comprehensible.
--
Neil Kandalgaonkar
neil@brevity.org
------------------------------
Date: Sun, 28 May 2000 22:47:38 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: sort routine fails
Message-Id: <MPG.139ba4474b8b021c98aafc@nntp.hpl.hp.com>
In article <392fc36a$0$22525@news.compuserve.de>,
linalina203@compuserve.de says...
...
> it would be great if anyone could help me. pls send a copy to
> skeeta\@muenster.de. Thanks.
Then that should be your Reply-To: header.
> data.txt:
> software|description|download|rating
> something 1.0|great proggie|http://u.r.traced.net/proggie.zip|5
...
> my @items = ();
>
> open (FH, "data.txt");
Always test for failure to open a file, even in a demp sample program.
> @items = sort { ${$b}[4] <=> ${$a}[4] } map { chomp; [ split(/\|/, $_) ] }
> <FH>;
Perl is not Fortran. Array indexes start from 0.
Use the '-w' flag in the future to help you identify bugs such as this.
[Stylistic note: I find that the array dereference $b->[4] is more
readable than the notation you use, but that is purely a personal
choice.]
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 29 May 2000 09:12:36 GMT
From: lou@visca.com (Lou Hevly)
Subject: Re: Translate foreign characters to English
Message-Id: <393157e5.28758785@news.uni-stuttgart.de>
newsmay2000@ordinate.co.uk (Ben Hambidge) wrote:
>I need to do a comparison to match words, but I want to be able to
>ignore diacritics on the letters.
>
>So if someone types into a web form a name or word including foreign
>(esp European) characters, I want to convert that string to the ASCII
>equivalent using standard English characters in order to see if the
>word exists in my array.
>
>Is there any easy way to do this?
Here's a subroutine that will do this; it also converts caps to small
letters, so you may have to modify it if that isn't what you want:
sub convert {
my ($ascii, $uline) = @_;
$ascii =~ tr/A-Z/a-z/;
$ascii =~ s/æ|Æ/ae/g;
$ascii =~ s/Á|Â|À|Å|Ã|Ä|á|â|à|å|ã|ä/a/g;
$ascii =~ s/Ç|ç/c/g;
$ascii =~ s/Ð|ð/d/g;
$ascii =~ s/É|Ê|È|Ë|é|ê|è|ë/e/g;
$ascii =~ s/Í|Î|Ì|Ï|í|î|ì|ï/i/g;
$ascii =~ s/Ñ|ñ/ny/g;
$ascii =~ s/Ó|Ô|Ò|Ø|Õ|Ö|ó|ô|ò|ø|õ|ö/o/g;
$ascii =~ s/ß/s/g;
$ascii =~ s/Þ|þ/t/g;
$ascii =~ s/Ú|Û|Ù|Ü|ú|û|ù|ü/u/g;
$ascii =~ s/Ý|ý|ÿ/y/g;
$ascii =~ s/#//g;
$ascii =~ s#\\|
\(|
\)|
\[|
\{|
\^|
\$|
\*|
\+|
\.|
\?|]|}|<|>|/|,|'|!|·|:|;|%|"##gx;
if ($uline) {$ascii =~ s/ /_/g}
else {$ascii =~ s/ //g};
return $ascii;
}
You call it thus:
my $euro_string = 'tres síl·labes';
my $new_string = convert($euro_string); # prints tressillabes
or
my $new_string = convert($euro_string, '1'); # prints tres_sillabes
>Do different codepages that the user
>may have on their browser make a difference?
Good question. I'll bet you'll get an answer if you ask it on
comp.infosystems.www.authoring.cgi.
--
All the best,
Lou Hevly
lou@visca.com
http://www.visca.com
------------------------------
Date: Mon, 29 May 2000 00:17:54 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Waxing Philosophical
Message-Id: <slrn8j3rri.4pl.tadmc@magna.metronet.com>
On Sun, 28 May 2000 20:42:03 -0400, Ryan & Treena Carrier <ryanc@nci1.net> wrote:
>Being a beginning programmer, please entertain my ignorance:
>
>What is the difference between
>
>while(<INFILE>) {
>}
This one is "special".
When the input operator is the _only_ thing in the condition
of a while, it is as if you had written:
while ( defined( $_=<INFILE>) ) {
>and
>
>until(!<INFILE>) {
>}
No magic copying to $_, so the line is discarded.
>and
>
>unless(!<INFILE>) {
>}
>
>Are they all the same?
That last one is a whole 'nother kettle of fish.
It is not even a looping construct like the others.
------
while() stops when the condition is false.
until() stops when the condition is true.
------
if() does the body if the condition is true.
unless() does the body if the condition is false.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 28 May 2000 22:16:59 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Waxing Philosophical
Message-Id: <3931FD4B.F4AC9AAB@stomp.stomp.tokyo>
Ryan & Treena Carrier wrote:
> Being a beginning programmer, please entertain my ignorance:
> What is the difference between
> while(<INFILE>) {
> }
> and
> until(!<INFILE>) {
> }
> and
> unless(!<INFILE>) {
> }
> Are they all the same?
Realistically, all the same.
Why not run a reality test? Isn't
reality of true interest to those
of us involved in programming rather
than philosophical differences in
performance of selected code?
Splitting hairs is for nit-pickers.
We can debate strings and sealing wax
till Puff The Magic Dragon realizes
Little Jackie Paper is long dead. In
the end, all amounts to the same;
star dust riding a solar wind.
Godzilla!
PRINTED RESULTS
_______________
While: Imagination Is More Important Than Knowledge.
Until: Imagination Is More Important Than Knowledge.
Unless: Imagination Is More Important Than Knowledge.
TEST SCRIPT
___________
#!/usr/local/bin/perl
print "Content-Type: text/plain\n\n";
$input = "Imagination Is More Important Than Knowledge.";
while($input)
{
print "While: $input \n\n";
$input = "";
}
$input = "Imagination Is More Important Than Knowledge.";
until(!($input))
{
print "Until: $input \n\n";
$input = "";
}
$input = "Imagination Is More Important Than Knowledge.";
unless(!($input))
{
print "Unless: $input \n\n";
$input = "";
}
exit;
------------------------------
Date: Mon, 29 May 2000 05:19:05 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Waxing Philosophical
Message-Id: <d5nY4.96585$hT2.395763@news1.rdc1.ct.home.com>
Ryan & Treena Carrier <ryanc@nci1.net> wrote:
> Being a beginning programmer, please entertain my ignorance:
> What is the difference between
> while(<INFILE>) {
> }
This rips through the file opened on INFILE and reads it record by record
and executes the body of the loop once for each record until it hits one
that evaluates to false. As a side-effect, it assigns each record to a
localized version of $_ while it does it.
> until(!<INFILE>) {
> }
This rips through the file opened on INFILE and reads it record by record,
executing the body of the loop once for each record until it hits one that
evaluates to false. It doesn't do anything with $_, so you basically have
no access to the data you've read from the file.
> unless(!<INFILE>) {
> }
This reads a single record from the file opened on INFILE and, if the
record is true, executes the body.
> Are they all the same?
What do you think now?
Dan
------------------------------
Date: Mon, 29 May 2000 07:13:29 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: Waxing Philosophical
Message-Id: <MPG.139cb5bab59176179896f0@news>
Godzilla! writes ..
>Ryan & Treena Carrier wrote:
>
>> Being a beginning programmer, please entertain my ignorance:
>
>> What is the difference between
>
>> while(<INFILE>) {
>> }
>
>> and
>
>> until(!<INFILE>) {
>> }
>
>> and
>
>> unless(!<INFILE>) {
>> }
>
>> Are they all the same?
>
>
>Realistically, all the same.
are they indeed ? .. here - have a free patch for your code
9c9
< print "While: $input \n\n";
---
> print "While ", lc $input, "Chaos reins in c.l.p.misc.\n\n";
17c17,18
< print "Until: $input \n\n";
---
> print "Until ", lc $input, "\n\tThis code demonstrates nothing to do ",
> "with the problem.\n\n";
25c26
< print "Unless: $input \n\n";
---
> print "Unless ", lc $input, "\n\tGodzilla is an idiot!\n\n";
--
jason - elephant@squirrelgroup.com -
------------------------------
Date: Mon, 29 May 2000 03:47:03 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Waxing Philosophical
Message-Id: <brian-ya02408000R2905000347030001@news.panix.com>
In article <3931FD4B.F4AC9AAB@stomp.stomp.tokyo>, "Godzilla!" <godzilla@stomp.stomp.tokyo> posted:
> Ryan & Treena Carrier wrote:
>
> > Being a beginning programmer, please entertain my ignorance:
>
> > What is the difference between
> > while(<INFILE>)
reads the next line of input, puts it into $_, and tests
for defined(). loops until there is not more input.
> > until(!<INFILE>) {
reads the next line of input, tests it, and negates it.
loops until it gets a false value.
> > unless(!<INFILE>) {
reads the next line of input, tests it, and negates it.
> > Are they all the same?
> Realistically, all the same.
they are not the same. stop spreading your ignorance.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>
------------------------------
Date: Mon, 29 May 2000 10:24:14 +0100
From: Dave Cross <dave@dave.org.uk>
Subject: Re: Waxing Philosophical
Message-Id: <9id4js8vp45qm2a4j4adpfimp83rum447q@4ax.com>
On Sun, 28 May 2000 22:16:59 -0700, "Godzilla!"
<godzilla@stomp.stomp.tokyo> wrote:
>Ryan & Treena Carrier wrote:
>
>> Being a beginning programmer, please entertain my ignorance:
>
>> What is the difference between
>
>> while(<INFILE>) {
>> }
>
>> and
>
>> until(!<INFILE>) {
>> }
>
>> and
>
>> unless(!<INFILE>) {
>> }
>
>> Are they all the same?
>
>Realistically, all the same.
As others havve pointed out, this is simply not true and your code
below does nothing to prove otherwise.
[snip mindles babblings!]
>PRINTED RESULTS
>_______________
>
>While: Imagination Is More Important Than Knowledge.
>
>Until: Imagination Is More Important Than Knowledge.
>
>Unless: Imagination Is More Important Than Knowledge.
>
>TEST SCRIPT
>___________
>
>
>#!/usr/local/bin/perl
>
>print "Content-Type: text/plain\n\n";
>
>$input = "Imagination Is More Important Than Knowledge.";
The OP was interested in <INPUT> as the condition on all of these
tests. Why have you changed it to a scalar variable? What does that
prove? And why do you set it to an empty string after each iteration?
>while($input)
> {
> print "While: $input \n\n";
> $input = "";
> }
>
>$input = "Imagination Is More Important Than Knowledge.";
>
>until(!($input))
> {
> print "Until: $input \n\n";
> $input = "";
> }
>
>$input = "Imagination Is More Important Than Knowledge.";
>
>unless(!($input))
> {
> print "Unless: $input \n\n";
> $input = "";
> }
>
>exit;
I can't seriously believe that anyone would think that this post would
add anything useful to the debate. You _must_ be doing it to
deliberately mislead people.
Dave...
--
<http://www.dave.org.uk> SMS: sms@dave.org.uk
yapc::Europe - London, 22 - 24 Sep <http://www.yapc.org/Europe/>
"There ain't half been some clever bastards" - Ian Dury [RIP]
------------------------------
Date: 29 May 2000 00:52:23 -0700
From: Sue Spence <sue@pennine.com>
Subject: Re: Weird script behaviour called from a web page.
Message-Id: <8gt7jn$1cht@drn.newsguy.com>
In article <39319b24.233927562@nntp.interaccess.com>, olczyk@interaccess.com
says...
>
>On Sun, 28 May 2000 16:31:06 +0100, Dave Cross <dave@dave.org.uk>
>wrote:
>
>>This is a Linux question rather than a Perl one and would be more
>>appropriate in a Linux or Unix newsgroup, but here goes anyway!
>>
>>An error like that doesn't always mean that the shell can't find the
>>script file. You'll also get that message if the shell can't find the
>>interpreter given by the #! line at the top of the script.
>>
>>You should check the first lines of both of these scripts and ensure
>>that they both point to a Perl interpreter.
>>
>>This theroy is backed up by the evidence that script2 works when
>>invoked as 'perl script2.pl' but not as simply 'script2.pl' as in the
>>first case the shell doesn't need the #! line to find the sripts
>>interpreter.
>>
>>Hope you don't think that I answered without thinking.
> Yeah you did.
No, he didn't. The tone of your response is why I didn't bother answering your
first demand for help, and probably why others haven't. You're one of those
ungrateful wretches who snarls at anyone who tries to help.
>I told you I cut and paste the first line from script1 to script2.
If you had explicitly said you'd copied the shebang/#! line, he probably
wouldn't have answered as he did.
>Since script1 works fine, I would presume that the line works.
>
>As for whether this a a Perl problem or a UNIX problem.
>Maybe it is maybe it isn't. Maybe it's apache.
>Once I solve the problem I will know. The fact that another similar
>script does run, would tend to indicate that it is not the general
>UNIX or Apache enviroment.
>
By that logic, since script1 works, then it isn't a Perl problem either. You
should either get more specific (much more specific) about your problem
description, or go away and figure it out yourself.
------------------------------
Date: Mon, 29 May 2000 09:57:10 +0000
From: rh@dragon.internal.gxn.net ()
Subject: Re: Weird script behaviour called from a web page.
Message-Id: <mtetg8.ka1.ln@dragon.lilycom.net>
In article <3930fc42.193253765@nntp.interaccess.com>,
olczyk@interaccess.com (Thaddeus L. Olczyk) writes:
> System: Linux (Mandrake 7.0)
> Server:Apache
[snip]
>
> #!/usr/bin/perl
> system 'perl fullscript2name',@args
[snip]
> I've cut and paste the first line from script1 to script2.
I got caught a few times with cut and paste in X11 where 'invisible'
characters appear or other nonsense happend. Remove the first line,
"write" it from scratch and try it again.
Hope this helps.
K.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 3193
**************************************