[9464] in Perl-Users-Digest
Perl-Users Digest, Issue: 3058 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jul 4 09:17:10 1998
Date: Sat, 4 Jul 98 06:13:58 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 4 Jul 1998 Volume: 8 Number: 3058
Today's topics:
Re: 2-byte code match problem (Abigail)
Re: 2-byte code match problem (Yun Giljung)
Re: 2-byte code match problem (Abigail)
Re: 2-byte code match problem (Yun Giljung)
Re: @list problem <eric@hilding.com>
Re: @list problem <eric@hilding.com>
attachment to email <vadepali@ix.netcom.com>
Re: attachment to email <quednauf@nortel.co.uk>
Re: attachment to email (Jonathan Stowe)
better way of getting the last modified file? <eugene@verticalnet.com>
Re: better way of getting the last modified file? <quednauf@nortel.co.uk>
Re: Chopping a String (Abigail)
Determining Users on NT Server with Perl <dhwright@mindspring.com>
Re: Determining Users on NT Server with Perl <ismkoehlerism@nmism-us.campus.mci.net>
file/directory mode problems within a perl script <rmullen@mcmail.com>
Re: flame everyone on sight (was Re: Perl and Delphi) (Bart Lateur)
Help with CGI Please <mark.hill1@virgin.net>
Re: Help with CGI Please <quednauf@nortel.co.uk>
Re: Help! Need Mult. Recipients (-)
Re: HELP: Problem building Perl5 on Cygnus target (Jonathan Stowe)
Re: Manipulating @INC for module include path (Jonathan Stowe)
perl with Mysql <ehb@ehb.iac.net>
Problem using Compiler-a3 with Perl5.004_O1 (Dan Franklin (Perl Posting))
Re: replacing search variable in foreach (-)
Script displaying IP address and hostnames? (Bill)
Re: Script displaying IP address and hostnames? <quednauf@nortel.co.uk>
Re: Script for event calendar <quednauf@nortel.co.uk>
Re: while (<CSV_FILE>) doesn't work with NT (Jonathan Stowe)
Win32 Modem driver <paul.gardner3@virgin.net>
Re: Win32 Modem driver <david.richards@alderley.zeneca.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 4 Jul 1998 07:01:55 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: 2-byte code match problem
Message-Id: <6nkk13$oj4$1@client3.news.psi.net>
Yun Giljung (mingtian@hanmail.net) wrote on MDCCLXVIII September MCMXCIII
in <URL: news:359d75f3.5352802@usenet.kornet21.net>:
++ cberry@cinenet.net (Craig Berry) wrote:
++
++ >Yun Giljung (mingtian@hanmail.net) wrote:
++ >: like Korean or Chinese, they are 2-byte code, so
++ >: it like
++ >:
++ >: ACFE BCA4 A7BC A4D9 (4 characters in hexcode)
++ >:
++ >: so if i try to s// or m// y// "BCA4" will match twice time
++ >: in above example, the first is correct but the second is not correct(
++ >: A7BC A4D9)
++ >:
++ >: how can solve the problem with s//,m//,y//?
++ >
++ >Here's a brute-force way to force even byte alignment:
++ >
++ > s/^((?:..)*?)\xBC\xA4/$1\x01\x02/sg;
++
++ that was not work.. i solved in 3 ways,
++
++ $han = chr(30);
++ $a = '>H3g H38p5N';
++ $a =~ s/([\A1-\xFE][\x4E-\x9F\xF9-\xFE])/$han$1/g;
++ $a =~ s/$hanH3/$han5i/g;
++ $a =~ s/$han([\A1-\xFE][\x4E-\x9F\xF9-\xFE])/$1/g;
++ print $a;
++
++ add special char before every 2-byte code and try match with
++ the special char which leads 2 bytes, the above code space
++ covers KSC5601(Korea), GB2312(China) and BIG5(HK,Taiwan)
++
++ any other better ways?
++
++ Larry Wall, how about add one special option to s//,m//,y// for us?
Larry is actually working on putting Unicode support (UTF-8 encoding)
into Perl. With unicode, characters will remain unities when dealing
with regexes and such. However, that isn't going to work in your case -
as the 16 bit encoding above isn't UTF-8 (which uses a variable width
encoding, in such a away that no bitsequence for a character matches
the two halves of other character bitsequences).
This will not help you in your case though, as you have true 16 bit
encoding. (And it probably doesn't match UCS-2 either)
Abigail
--
perl -wle\$_=\<\<EOT\;y/\\n/\ /\;print\; -eJust -eanother -ePerl -eHacker -eEOT
------------------------------
Date: Sat, 04 Jul 1998 08:37:03 GMT
From: mingtian@hanmail.net (Yun Giljung)
Subject: Re: 2-byte code match problem
Message-Id: <359de7d1.34507217@usenet.kornet21.net>
>Larry is actually working on putting Unicode support (UTF-8 encoding)
>into Perl. With unicode, characters will remain unities when dealing
..
i hope Perl is not be like Java or Visual Basic or TCL that use Unicode
for their internal system, that really does not help 2 bytes codes.
they just making another problem, unicode is just annoying code.
with Java we korean and chinese are having more trouble with our languages
as we havd to convert the code from-unicode, to-unicode everytime!
everywhere! in fact Java does not support this perfectly but Java
uses Unicode.
------------------------------
Date: 4 Jul 1998 11:06:21 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: 2-byte code match problem
Message-Id: <6nl2bd$q48$1@client3.news.psi.net>
Yun Giljung (mingtian@hanmail.net) wrote on MDCCLXVIII September MCMXCIII
in <URL: news:359de7d1.34507217@usenet.kornet21.net>:
++ >Larry is actually working on putting Unicode support (UTF-8 encoding)
++ >into Perl. With unicode, characters will remain unities when dealing
++ ..
++
++ i hope Perl is not be like Java or Visual Basic or TCL that use Unicode
++ for their internal system, that really does not help 2 bytes codes.
++ they just making another problem, unicode is just annoying code.
++ with Java we korean and chinese are having more trouble with our languages
++ as we havd to convert the code from-unicode, to-unicode everytime!
++ everywhere! in fact Java does not support this perfectly but Java
++ uses Unicode.
There doesn't seem to be any indication Perl is going towards fixed
width 16bit characters. But it will have UTF-8 support.
Perl has always been Western oriented, and it seems I18N means
Unicode, not 16 bit chars.
Abigail
--
perl -wle '(1 x $_) !~ /^(11+)\1+$/ && print while ++ $_'
------------------------------
Date: Sat, 04 Jul 1998 12:24:36 GMT
From: mingtian@hanmail.net (Yun Giljung)
Subject: Re: 2-byte code match problem
Message-Id: <359e1c0e.47881494@usenet.kornet21.net>
abigail@fnx.com (Abigail) wrote:
>There doesn't seem to be any indication Perl is going towards fixed
>width 16bit characters. But it will have UTF-8 support.
>
>Perl has always been Western oriented, and it seems I18N means
>Unicode, not 16 bit chars.
I meant what you said..
i18n is mostly just funny idea, the one good point of MS is
its Korean,Chinese,Japanese..versions of win95/NT/3.1..and
tightly fixed version of international versions of software.
that's why i18n is just annoying and funny thing, i hope Perl does not
follow such useless thing.
the idea of 'checking locale or something and showing allong with it'
is just annoying idea and not good idea, i hope OS, language tools
just read,output and USER select apprpriate software,fonts...etc.
under erd hat linux 4.x and over it always complains "Locale...!@#$"
when it is not LANG=c, it's not good idea, just run and show the result!
user will make routine without locale setting,
8bit area of one code may not be a letter for english so it refers locale..
this idea is not that good, german user can add such chars when checking
and the people like me will make new long routine with 'while' and 'for'
to do s//,m//,y// , it's better a way.
i hope Perl just to be for only mostly english version not i18n version like Java.
making another way of implementing for 2 bytes code from english version is better
than using Unicode or referring to Locale stuff for my opinion.
------------------------------
Date: Thu, 02 Jul 1998 22:28:47 -0700
From: Eric Hilding <eric@hilding.com>
Subject: Re: @list problem
Message-Id: <359C6C0F.5D89@hilding.com>
Bob Trieger wrote:
>
> Eric Hilding <nospam@xx.com> wrote:
> -> It's gotta be something simple that I'm tripping over, but can't
> -> seem to find it.
>
> That is why you should use the `-w' switch. It will show you the errors.
> I checked it with -wc and it showed syntax ok.
> Use a shebang line with the -w switch as the very first line:
> #1/usr/bin/perl -w or #!c:/perl/bin/perl -w
> Ooops...forgot to mention I'm just using it in WinPerl32 and
no shebang necessary :-)
Thanks much to you and Josh for the responses with the items
that were definitely out-of-sync.
Eric
------------------------------
Date: Thu, 02 Jul 1998 22:41:08 -0700
From: Eric Hilding <eric@hilding.com>
To: Tad McClellan <tadmc@flash.net>
Subject: Re: @list problem
Message-Id: <359C6EF4.53F9@hilding.com>
Tad McClellan wrote:
>
> Eric Hilding (nospam@xx.com) wrote:
> : It's gotta be something simple that I'm tripping over, but can't
> ^^^^^^^^^
> It is about half a dozen somethings ;-)
> Ummh, so I've found out ;^0
> And it appears that you are not going to tell us what problem
> you are having either.
> You should really have shared that with us.
Whip me again (I deserve it). I had hacked up another script of
mine that worked fine...didn't have a book with me at the office,
and actually chased around some on-line man pages but obviously
was not having a good day of it. I looked at another script I
had with a list assignment and print out (which also works fine),
but turns out I had 'other' problems.
>
> What does "tripping" mean here?
> I should have said "stumbling" over :-)
> Never generates any output?
> It only wrote the last entry in the original text file to the
new file...like a one element list (I guess that's what you'd
call it).
> Generates incorrect output?
> See above.
> Dumps core?
> Ummh, I am a perl quad when it comes to 'core' ;^0
> Spits out error messages?
Nope...not on my Win32 system...unless I missed them.
Tnx for the help, Tad. Sorry I forgot to describe the problem.
Eric
------------------------------
Date: Sat, 04 Jul 1998 00:04:33 -0700
From: Gangadhar Vaddepalli <vadepali@ix.netcom.com>
Subject: attachment to email
Message-Id: <359DD401.69C5E5C5@ix.netcom.com>
Hi There,
I'm wondering whether we can attach another file to email using Perl.
I want to send an attchment which is also an HTML file along with the
message.
Can anybody give me some idea?
--
Thanks
Gangadhar
Tel: (650)964-1807
vadepali@ix.netcom.com
------------------------------
Date: Sat, 04 Jul 1998 13:09:54 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: attachment to email
Message-Id: <359E1B92.9B05E9B2@nortel.co.uk>
Gangadhar Vaddepalli wrote:
>
> Hi There,
> I'm wondering whether we can attach another file to email using Perl.
> I want to send an attchment which is also an HTML file along with the
> message.
>
There are many ways of doing this (TMTOWTDI). For one of those ways check my
webpage, whose address is in my sig.
--
____________________________________________________________
Frank Quednau
http://www.surrey.ac.uk/~me51fq
________________________________________________
------------------------------
Date: Sat, 04 Jul 1998 12:41:17 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: attachment to email
Message-Id: <359e1819.364427@news.btinternet.com>
On Sat, 04 Jul 1998 00:04:33 -0700, Gangadhar Vaddepalli wrote :
>Hi There,
>I'm wondering whether we can attach another file to email using Perl.
>I want to send an attchment which is also an HTML file along with the
>message.
>
>Can anybody give me some idea?
>
On CPAN there are a variety of modules available that deal with
Various aspects of E-Mailing including MIME. The implementation of a
mail user-agent in perl is usually dependent on the system you are
running the program on. This subject oftem causes quite a lot of
excitement on this group - you might find it interesting to search
DejaNews on the subject of mail.
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Sat, 04 Jul 1998 07:35:30 -0400
From: Eugene Sotirescu <eugene@verticalnet.com>
Subject: better way of getting the last modified file?
Message-Id: <359E1382.4F53AD02@verticalnet.com>
I'm getting the last modified file in a directory thusly:
@my_files = `ls -t $DIR`;
$myfile = $my_files[0];
Is there any better way of doing this, without spawning a shell?
Thanks.
------------------------------
Date: Sat, 04 Jul 1998 13:20:57 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: better way of getting the last modified file?
Message-Id: <359E1E29.394AEB4B@nortel.co.uk>
Eugene Sotirescu wrote:
>
> I'm getting the last modified file in a directory thusly:
> [code]
> Is there any better way of doing this, without spawning a shell?
Check the perlfunc (opendir, readdir, stat). For an OO approach to the last
modified date, check the File::Stat module. For checking the last modified file,
do your own sort on the modified date property.
--
____________________________________________________________
Frank Quednau
http://www.surrey.ac.uk/~me51fq
________________________________________________
------------------------------
Date: 4 Jul 1998 07:06:34 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Chopping a String
Message-Id: <6nkk9q$oj4$2@client3.news.psi.net>
Craig Berry (cberry@cinenet.net) wrote on MDCCLXVII September MCMXCIII in
<URL: news:6njef3$8ve$1@marina.cinenet.net>:
++ Bob Trieger (sowmaster@juicepigs.com) wrote:
++ : Else @array = split /(.{50})/,$your_string;
++
++ Note that will result in empty strings interleaved with the string pieces.
If one really wants to use split:
@array = grep {length} split /(.{50})/, $your_string;
Abigail
--
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")\n-> define ("foldoc", "perl")) [0] -> print'
------------------------------
Date: Sat, 04 Jul 1998 01:01:52 -0700
From: Dave Wright <dhwright@mindspring.com>
Subject: Determining Users on NT Server with Perl
Message-Id: <359DE170.66CD@mindspring.com>
Is there a way to determine all of the logged in users on a NT
server using Perl/Win32? Thanx.
Dave
dhwright@mindspring.com
------------------------------
Date: Sat, 4 Jul 1998 00:05:35 -0600
From: "Rick K" <ismkoehlerism@nmism-us.campus.mci.net>
Subject: Re: Determining Users on NT Server with Perl
Message-Id: <6nkgno$69r$1@news.campus.mci.net>
Dave Wright wrote in message ...
>Is there a way to determine all of the logged in users on a NT
>server using Perl/Win32? Thanx.
I would suggest investigating one of the Win32 extensions,
specifically Win32::EventLog ... I think you could scan for
event ids related to login/logout activities.
Another place to look is Win32:NetAdmin, but during my cursory
glance at the description, nothing really shouted out "Eureka!".
Good luck. Sorry I couldn't provide more help.
------------------------------
Date: Sat, 04 Jul 1998 13:24:46 +0100
From: Ross Mullen <rmullen@mcmail.com>
Subject: file/directory mode problems within a perl script
Message-Id: <359E1F0E.877DF8B9@mcmail.com>
I have an irritating problem which someone may be able to help me out
with. It concerns a HTML form which accepts data and passes this to a
script, one form parameter is for "county" and depending what the user
types in will create a directory and place everything else typed in the
form into a file in this newly created directory.
When the program is first run it creates the directory with appropriate
file/directory modes and creates the file with all the form data.
However if the program is run again (as I want the program to append
data into this file) it displays a server error.
I have been told by the server administration that a script periodically
runs and chowns everything in my directory back to me, and I cant change
the modes on the directories or files as the web server doesn't have
permission to set permissions in my directory, it is running at a low
privilege user. If I try to manually change the file modes I receive
"operation not permitted".
My script requires the files to be updated in real-time and obviously at
the moment this cant happen, can anyone explain how I could get round
this problem. I have used the PERL >> operator to appended to the file.
Thanks in advance
------------------------------
Date: Sat, 04 Jul 1998 08:30:54 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: flame everyone on sight (was Re: Perl and Delphi)
Message-Id: <359fe4ee.1488357@news.tornado.be>
Russell Schulz wrote:
>> A little hyper-sensitive, are we?
>
>well, I'm not. that leaves only you.
Boy, this is really on-topic for clpm.
Bart.
--
Stop Wasting Bandwidth!
------------------------------
Date: Sat, 04 Jul 1998 12:00:19 +0200
From: Mark Hill <mark.hill1@virgin.net>
Subject: Help with CGI Please
Message-Id: <359DFD33.4419@virgin.net>
My ISP does not allow CGI scrips at the moment,(I may now have found
one).
I want to include a simple word search on my site similar to the
one on this page
http://www.systemsoft.com/
where do I start.
Regards,
Mark.
------------------------------
Date: Sat, 04 Jul 1998 13:13:55 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Help with CGI Please
Message-Id: <359E1C83.4B2F72F9@nortel.co.uk>
Mark Hill wrote:
> I want to include a simple word search on my site ...
this is more of a cgi question, but you could use one of the many free script
available.
Try cgiresources.com for a starter.
--
____________________________________________________________
Frank Quednau
http://www.surrey.ac.uk/~me51fq
________________________________________________
------------------------------
Date: Sat, 04 Jul 1998 05:39:45 GMT
From: root.noharvest.\@not_even\here.com (-)
Subject: Re: Help! Need Mult. Recipients
Message-Id: <359dbecf.92290886@news2.cais.com>
James McComb <james_mccomb@intuit.com> Said this:
>Using a basic form.cgi (utilizing cgi-lib.pl), I need to make it so the
>submitted information goes to multiple recipients.
>
>The cgi currently reads:
>$recipient = "address\@domain.com";
>
>I need to be able to specify more than one email address, and, if
>possible, for it to strip out an email address posted as a bcc for a
>third email.
>
>The part that strips out the email for the reply to address reads as:
>print MAIL "Reply-to: $in{'email'}\n";
>
So you looked far enough into the script to find where it's actually
"talking" to sendmail? Great! You have the answer right in front of
you and you just didn't know it ;)
print MAIL "Cc: $second_recipient, $third_recipient\n";
print MAIL "Bcc: $fourth_recipient\n";
insert that in somewhere near print MAIL "Reply-to:blahblah\n"; and it
should work. just make sure it's BEFORE the header delimiter (the
double \n)
Any valid header can be written, Reply-to:, Organization:, Subject:,
etc... and if you want to create one for some reason, put an X- in
front of it, and most email clients will just ignore it (but print it
in the "full headers") like this: X-test_header: blah blah
or whatever.
------------------------------
Date: Sat, 04 Jul 1998 09:02:28 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: HELP: Problem building Perl5 on Cygnus target
Message-Id: <359de860.2486399@news.btinternet.com>
On Thu, 02 Jul 1998 15:20:32 +0200, CRETEL Dominique wrote :
>Hi all,
>
>I'm trying to build Perl5.00_04 on Cygnus-Win32 target.
>
>All is OK untill the shell script want to use the gcc2 file (that I have
>copied in the same place than gcc.exe, i.e. in the bin directory which
>is in my PATH!!!
>------------
>bash-2.01$ gcc
>gcc: No input files
>bash-2.01$ gcc2
>bash: //D/Cygnus/B19/H-i386-cygwin32/bin/gcc2: No such file or directory
>bash-2.01$
>------------
gcc2 is a shell script I think - if it is and you look at it you will
find that the #! line points to a non-existent interpreter : check the
path to your version of bash.
/j\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Sat, 04 Jul 1998 09:02:31 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Manipulating @INC for module include path
Message-Id: <359de977.2765199@news.btinternet.com>
On Thu, 02 Jul 1998 19:11:49 +0200, Ulf Wendel wrote :
>
>
>Mike West schrieb:
>
>> Try
>>
>> use HTML::Entities qw(entities);
>
>It looks good. But now perl complains:
>
>Global symbol "..." requieres expicit package name at html/entities.pm at
>...
>
I think you'll find that Mike meant to use his answer in exclusion to
either of the solutions you tried not in addition to.
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Sat, 04 Jul 1998 02:02:57 -0500
From: "Eric H. Buschelmann" <ehb@ehb.iac.net>
Subject: perl with Mysql
Message-Id: <359DD3A0.57A3D3E2@ehb.iac.net>
I am fairly new to Perl and CGI... However, I have begun to see what a
pain it is to use flat text files as databases. Could someone please
point me to a website or other source that will show me how to use Mysql
server with Perl 5??? I would appreciate this SO SO Much... I have been
going crazy trying to get this thing to work....
Thank you in advance for your help.
Please email: ehb@iac.net
Thank you!
Eric Buschelmann
------------------------------
Date: Sat, 04 Jul 1998 05:17:46 GMT
From: danperl@copernicus.bbn.com (Dan Franklin (Perl Posting))
Subject: Problem using Compiler-a3 with Perl5.004_O1
Message-Id: <_Vin1.1$FS1.19229@cam-news-reader1.bbnplanet.com>
The Perl compiler looked like a good thing to try to speed up a
CGI script of a colleague's (it's not working too well under mod-perl, so this
was the next thing to try). But when I tried it, the compiler barfed:
perl -MO=Bytecode,-obytecode.cgi index.cgi
Bad free() ignored at /usr/local/edtech/perl/lib/DynaLoader.pm line 155.
index.cgi syntax OK
113552: no such instruction "op"
Assembly failed with 1 error(s)
END failed--cleanup aborted, <READER> chunk 113552.
leaving me with a perl corefile and a bytecode.cgi file that doesn't do much
when I run it through byteperl.
Now, the version of perl I'm using is 5.004_O1, and the Compiler-a3
documentation does say I need either Perl5.002 or 5.003, so perhaps that's
the problem - but before I tell my colleague he has to go back-rev on his
version of perl, I thought I'd try this list to see if anyone has suggestions.
The code is too big to post (of course - if it were small I wouldn't care
about compilation speed) and the error message above doesn't help much in
narrowing down the problem. But if no one reading this can tell what's going
on, then I'll probably try to coerce the compiler into giving me more info
than a mysterious large number so I can at least figure out what line is
giving it indigestion.
Dan Franklin
------------------------------
Date: Sat, 04 Jul 1998 05:28:31 GMT
From: root.noharvest.\@not_even\here.com (-)
Subject: Re: replacing search variable in foreach
Message-Id: <359db631.90084910@news2.cais.com>
Tom Phoenix <rootbeer@teleport.com> Said this:
>On Mon, 29 Jun 1998, Randy Kimple wrote:
>
>> I have a foreach loop in which I need to replace a section of code with
>> a different line each time through.
>> Here is a snipet of my code in which $insert needs to change each time
>> through the loop.
>
>
>> foreach $position(@position) {
>> open(FILE, "$section");
>
>It's unlikely (but possible) that you want to open a new file each time
>through the loop. It's more likely that you want to open it once, outside
>the loop. (You may or may not want to seek to the beginning in each
>iteration.)
Perhaps he's grep'ed a directory into @position, and now he's
accessing each file looking for something?
>
>Of course, those double quotes are merely misleading. And even when your
>script is "just an example" (and perhaps especially in that case!) you
>should _always_ check the return value after opening a file.
Do you have this on some kind of macro? It's the same wording every
time!!! What's your hangup with return values? I never use return
values, and my programs work great.
>
>> while($file = <FILE>) {
>> if ($insert[$position]) {
>
>Of course, this is different than $insert which you mentioned earlier.
He's a newbie... be nice and explain it to him, rather than simply
looking down your nose at him and pointing out the mistake without the
solution. He's referring to an array, but at the moment I don't think
he's got the full concept of @array, $#array, $array[xx], etc. Point
out his mistake, but then try to explain it. He's figured out how to
index his array, that's a pretty good start ;)
>
>> print "The number of hits is: $key\n";
>
>What's all this trying to do? What are $key, @insert, and $section?
>
>> }
>> }
>
>> $insert is of the form:
>> ($junk, $hits) = $file =~ m/(\s*matched\s<B>)(\d*)/
unless you are using $junk, don't bother with it.... you can use a
single backreference in your regular expression, so just (\d*) alone
will work fine. also, you can use (\d{1,5}) if you know it's a 1 to 5
digit number, for example - if that makes it any easier...
($hits) = $file =~ m/\s*matched\s<B>(\d*)/
>
>> Earlier in the program I initialize @insert with the different strings
>> that need to put in the program. As $position increments each time
>> through, a different $insert is accessed.
>
>Maybe you mean that you intend to increment $position each time through
>the loop. That could be meaningful.
I think what he means is that he wants the value of $insert to
correspond to $position, if $position is used as a key..... ???
I'm just taking a stab at this, but I think you really want a hash.
Like this:
($hits) = $file =~ m/\s*matched\s<B>(\d*)/
$insert{$some_variable_like_position} = $hits;
foreach $position(@position)
{
open(FILE, "$section");
while($file = <FILE>)
{
if ($insert{$position})
{
print "The number of hits is:
$insert{$position}\n";
}
}
}
Some people will balk at how I construct my blocks, but it's
especially useful when you are learning - you can follow the columns
to find matching brackets within large nested constructs easier this
way - it's a holdover from my long-gone pascal and cobol days.
Not knowing exactly what you are trying to do, I have to guess... I
think a hash will work better. If you haven't gotten to hashes yet, I
can attempt a rough explanation for you:
%hash = ("key" => "value");
$hash{key} = value;
if we load up a hash like this:
%hash = (1 => "one", 2 => "two", 3 => "three", 4 => "four");
Example One:
foreach $number (keys %hash)
{
print "$number: $hash{$number}\n";
}
--prints like this:
1: one
2: two
3: three
4: four
Example Two:
$number = 1;
print "$hash{$number}\n";
$number = 4;
print "$hash{$number}\n";
--prints like this:
one
four
Example Three:
@array = (1, 2, 3, 4);
foreach $num (@array)
{
print "$num: $hash{$num}\n";
}
--prints like this:
1: one
2: two
3: three
4: four
Does that make any sense?? So if $position matches the key in
%insert, then you'll get the value.
------------------------------
Date: Sat, 04 Jul 1998 11:27:16 GMT
From: btay@nospam.com2000.net (Bill)
Subject: Script displaying IP address and hostnames?
Message-Id: <btay-ya02408000R0407980727270001@news1.nj.home.net>
Does anybody knows if there's a script written in perl for Windows NT IIS
4.0 that will display a visitor's IP address and hostname when accessing a
particular web page such as a web form?
Any help would be appreciated.
Regards,
Bill
btay@nospam.com2000.net
*Note: When replying, remove "nospam" from the return email address.
------------------------------
Date: Sat, 04 Jul 1998 13:16:44 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Script displaying IP address and hostnames?
Message-Id: <359E1D2C.748F32BA@nortel.co.uk>
Bill wrote:
>
> Does anybody knows if there's a script written in perl for Windows NT IIS
> 4.0 that will display a visitor's IP address and hostname when accessing a
> particular web page such as a web form?
Another cgi-question. The %ENV - hash stores the whole cgi context your script
is runnning in.
Try this for a starter: (untested)
print "Content-type: text/html\n\n";
foreach $key(keys %ENV) {
print "$key = $ENV{$key}";
}
--
____________________________________________________________
Frank Quednau
http://www.surrey.ac.uk/~me51fq
________________________________________________
------------------------------
Date: Sat, 04 Jul 1998 13:03:26 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Script for event calendar
Message-Id: <359E1A0E.74DFDE2D@nortel.co.uk>
Cornel wrote:
>
> Hallo!
> Kennt jemand von Euch ein gutes und einfaches Skript f|r einen
> Veranstaltungskalender, das, wenn mvglich, keine Werbung enthdlt.
> Tsch|_ Cornel
Hello,
does anyone of you know of a good and simple event calendar script, which,
if possible, doesn't contain any ads.
Bye Cornel
I don't, and frankly, this isn't the right place to look for it. Try one of the
MANY
cgiresources on the web. For a starter, try cgiresources.com...
--
____________________________________________________________
Frank Quednau
http://www.surrey.ac.uk/~me51fq
________________________________________________
------------------------------
Date: Sat, 04 Jul 1998 09:02:26 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: while (<CSV_FILE>) doesn't work with NT
Message-Id: <359de5ec.1858881@news.btinternet.com>
On Thu, 02 Jul 1998 20:10:32 GMT, scythale@my-dejanews.com wrote :
>
>Warning: if you are on an UNC share, opendir won't work, but if on this share
>you create a subdirectory, it works ! Undocumented everywhere !
>
It will however work if you map it to a drive letter with
Win32::NetResource::AddConnection.
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: 4 Jul 1998 09:37:01 GMT
From: "Paul, Dee & Mark Gardner" <paul.gardner3@virgin.net>
Subject: Win32 Modem driver
Message-Id: <01bda748$bde00120$4245a8c2@paul.gardner3>
I would like to use the Win32 distribution of perl to write
a modem driver routine. Having managed to redirect the
serial port as desbribed in a recent FAQ, I can find no way of setting the
protocol settings (baud rate, parity, stop bits) for the PC's COMM port.
In a UNIX environment the posix.pm module seems to do the trick, on WIN32
there seems to be no equivalent.
Can anyone help.
------------------------------
Date: 4 Jul 1998 12:15:44 GMT
From: "David Richards" <david.richards@alderley.zeneca.com>
Subject: Re: Win32 Modem driver
Message-Id: <01bda745$78e382c0$55a0479c@UKMCPHISFW051.ukmcph.zeneca.com>
Have a look at the Win32::SerialPort module on CPAN.
David
Paul, Dee & Mark Gardner <paul.gardner3@virgin.net> wrote in article
<01bda748$bde00120$4245a8c2@paul.gardner3>...
> I would like to use the Win32 distribution of perl to write
> a modem driver routine. Having managed to redirect the
> serial port as desbribed in a recent FAQ, I can find no way of setting
the
> protocol settings (baud rate, parity, stop bits) for the PC's COMM port.
------------------------------
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 3058
**************************************