[13102] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 512 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 13 20:07:15 1999

Date: Fri, 13 Aug 1999 17:05:15 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 13 Aug 1999     Volume: 9 Number: 512

Today's topics:
    Re: A CGI/Perl Question (Kevin Reid)
    Re: C<print <FILE>;> -- is it optimized (Eric Bohlman)
    Re: Calculation problems in Perl <alex[at]suffix.demon.co.uk>
    Re: can i read a file backwards? (Neko)
        Can Perl 5 open a 4 gig text file? <kretek@fastlane.net>
        djgpp, Win98, Perl, and serial port <dchristensen@california.com>
    Re: getting web page content (Jerome O'Neil)
    Re: Good Web Sites on Perl/DBI/MySQL? <jbc@shell2.la.best.com>
    Re: Help getting Perl to work on Windows 98 <dchristensen@california.com>
        Limitation on number of rows fetched from database ? <mnikhil@worldnet.att.net>
    Re: Looking for gibberish generator <elaine@chaos.wustl.edu>
        Major pack() gripe <brundlefly76@hotmail.com>
        Passing associative arrays to CGI scripts (perl) ("Joseph R. Wyrembelski")
        perl for Windows CE 2.0? <Noah_Davids@stratus.com>
    Re: perl for Windows CE 2.0? <elaine@chaos.wustl.edu>
        Perl Programmers' Web Design "Difficulties" <tristar@direct.ca>
    Re: perl script for changing all upper case letters to  <elaine@chaos.wustl.edu>
    Re: reference to object method <dchristensen@california.com>
    Re: regular expression - counting words and quotes <ltl@rgsun5.viasystems.com>
    Re: Spawning OS Command from Perl <dchristensen@california.com>
        This code is killing me!!! Help! <jsb@electron-alchemy.com>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Fri, 13 Aug 1999 19:15:34 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: A CGI/Perl Question
Message-Id: <1dwhgja.11boq24udgowcN@imac.loc>

brian d foy <brian@pm.org> wrote:

> In article <Pine.HPP.3.95a.990813123416.8178C-100000@hpplus03.cern.ch>,
> "Alan J. Flavell" <flavell@mail.cern.ch> posted:
> > >   $referring_url = $ENV{^ÑHTTP_REFERER^Ò};
> > Somehow I don't think Perl is going to like that.
> it's certainly not going to give the desired information. ;)

I think it was a case of curly quotes.

-- 
 Kevin Reid: |    Macintosh:      
  "I'm me."  | Think different.


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

Date: 13 Aug 1999 23:27:59 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: C<print <FILE>;> -- is it optimized
Message-Id: <7p29lv$h2l@dfw-ixnews3.ix.netcom.com>

Jeff Pinyan (jeffp@crusoe.net) wrote:
:   timethese(4, {
:     array => q{ @array = <FILE>; print OUT @array; seek FILE, 0, 0 },
:     loop => q{ print OUT while <FILE>; seek FILE, 0, 0 },
:     slurp => q{ print OUT <FILE>; seek FILE, 0, 0 },
:   });

: The results baffled me a little:
:   array => 13.31
:    loop => 10.68
:   slurp => 9.54
: 
: Oh dear.  I thought the while loop would be better than slurping the file
: in the C<print <FILE>;> statement.
: 
: Has the 'slurp' use been optimized in Perl?  If so, that'd be a good thing
: to know.

I don't think so.  What's happening is that both loop and slurp are 
looping through the file, but loop is doing the looping with Perl 
operations, whereas slurp is doing all its looping inside C code.  
Therefore loop has more interpreter overhead than slurp.



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

Date: Sat, 14 Aug 1999 00:25:50 +0100
From: "Alex Croton" <alex[at]suffix.demon.co.uk>
Subject: Re: Calculation problems in Perl
Message-Id: <934586873.10359.0.nnrp-08.9e98d8a3@news.demon.co.uk>


John Porter <jdporter@min.net> wrote in message
news:slrn7r5ppi.ggv.jdporter@min.net...
> Alex Croton wrote:
> >
> >   print "Calc:  Type=> $type\t\tOld=> $bal\t\tChange=> $change\t\tNew=>
> >$newBal\n";
> >   return ($newBal/100);
> >} # end sub calcBal
> >
> >Where the parameters $bal and $change are 2dp numeric values, I am
getting
> >(sometimes) lines on the output as follows :-
> >
> >"Calc:  Type=> Pay  Old=> 46.73  Change=> 38.87  New=> 786.000000000002"
>
> I hate to have to say it, but: RTFM.
>
> in perldoc perlfaq4 - Data Manipulation,
> the very first question -- THE VERY FIRST! -- is:
>     Why am I getting long decimals (eg, 19.9499999999999)
>     instead of the numbers I should be getting (eg, 19.95)?
>
> hth, hand,
> John Porter
>

John,

Thanks for pointing me at the docs - I didn't have the full set loaded at
the time - I do now.

But...
You may have noticed the /100 in the return statement - this was an
accidental leftover from some working on the probem, where I thought that I
was suffering from just the problem mentioned in the docs.

My work around was to multiply the incoming vars by 100, and then int() them
to get the whole integer only, then perform the calculation, and divide by
100 to get the correct number.

When I was getting the correct input numbers (albeit 100 times greater), why
was the subtraction still introducing this type of error, I was printing the
result of the calcuation before the final /100.

This time the result looks like :
"Calc:  Type=> Pay  Old=> 4673  Change=> 3887  New=> 786.000000000002"

(Yes, I know the output value is the same - I think that this result may
have been from the run with the *100's, but with the print of the first part
before the multiplcation)

I have now coded round this, and got the routine working - with some hideous
and clunky code, but I'm still interested in why I was getting the problem.

I'm probably being _REALLY_ dense, and will get told to RTFM again (or wake
up!) but I don't believe that the FAQ entry applies when only whole integers
are being used.

Regards,

Alex Croton










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

Date: 13 Aug 1999 23:52:20 GMT
From: tgy@chocobo.org (Neko)
Subject: Re: can i read a file backwards?
Message-Id: <7p2b3k$evt$1@216.39.141.200>

On Fri, 13 Aug 1999 17:43:17 -0500, Stacy <stacy@beast.amd.com> wrote:

>Mike wrote:
>>
>> open(FILE, "normal.txt");
>>   @file = <FILE>;
>> close(FILE);
>>
>> @backwards = reverse(@file);
>>
>> foreach(@backwards) {
>>   @line = split(//, $_);
>>   print reverse(@line);
>> }
>
>In search of simplicity ...
>-----reverse.pl-----
>
>#!/usr/bin/perl -w
>
>$/ = undef;
>print reverse split (//, <>);
>
>---------------

$/ = undef
print scalar reverse <>;

>... of course you could do it all from the command line
>
>perl -e '$/=undef; print reverse split(//,<>);' some.file

perl -p0777e '$_=reverse' some.file

-- 
Neko | tgy@chocobo.org | Will hack Perl for a moogle stuffy! =^.^=


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

Date: Fri, 13 Aug 1999 18:57:23 -0500
From: "Duncan Idaho" <kretek@fastlane.net>
Subject: Can Perl 5 open a 4 gig text file?
Message-Id: <0BFEE4828427A0A6.7CBECF8D63941C4A.488E601871A4F67A@lp.airnews.net>

I've run into a problem trying to read a 4 gig text file
with Perl5. It seems that Perl has a 2 gig limit on opening
a file. Returns an error of file is too big. This is on a Unix
system (IBM AIX). The Sys Admin said that there is a problem
with opening over 2 gig files on the Unix system. To open files
over 2 gig, you need to us the C function  open64() instead of
open() in a C program. Does anyone know if Perl has an equivalent open
function?
If not, is it possible for me to call the C function in the Perl script?
Has anyone else had a similar problem and how did you remedy it?
Any help would be much appreciated.

Thank You





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

Date: Fri, 13 Aug 1999 16:17:50 -0700
From: "David Christensen" <dchristensen@california.com>
Subject: djgpp, Win98, Perl, and serial port
Message-Id: <37b4a540@news5.newsfeeds.com>

comp.os.msdos.djgpp
comp.lang.perl.misc

Hello, World!

I am running the FSF distribution of DJGPP 2.01 (?) and Perl
5.004_02 on my Win98 box.  I am attempting to communicate with a
machine we are developing via the serial port (9600 8-N-1).  I have
grep'ed and read through several docs (open, sysopen, perlfaq8,
config.h, ioctrl.h, etc.) trying to piece together the clues.  This
is my current attempt -- it's supposed to read ten lines from the
port, printing each on the screen and also echoing them back to the
sender, pausing 1 second after each:

      1 #!/fsf/bin/perl -w
      2 use FileHandle;
      3
      4 sysopen HANDLE, "COM1", O_RDWR | O_EXCL, 0700
      5     or die "sysopen failed: $!\n";
      6
      7 my $i = 10;
      8
      9 print "entering while loop ...\n";
     10 while ($i-- > 0 && defined($_ = <HANDLE>)) {
     11     print HANDLE $_;
     12     print $_;
     13     sleep 1;
     14     print "bottom of  while loop ...\n";
     15 }
     16 print "leaving while loop ...\n";
     17
     18 close HANDLE;


Both COM1 and COM2 are free on my machine, so I connected a null
modem cable between them.  When I run two instances of
Hyperterminal, one on each port, I can type back and forth between
the two.  When I shutdown Hyperterminal on COM1 and start the above
Perl code in a Bash box, one of two things happens:

1. It prints "entering while loop ..." and then hogs the machine
(typing on Hyperterminal 2 doesn't show up in Bash;  ctrl+C,
ctrl+D, and ctrl+Z don't work; need 3-finger salute to kill it), or

2. It prints "entering while loop ...", prints "leaving while loop
 ...", and then exits (encountered EOF on HANDLE?).


Searching around on Deja, it looks like people with ActivePerl have
some modules (Win32::SerialPort, Win32::CommPort, and Win32::API)
to make life easier.  There is also supposed to be a Un*x version
of ::SerialPort.


On 1999/07/23, Bbirthisel <bbirthisel@aol.com> posted a message
"Re: What is the best way to write data to a com port under DOS."
to comp.lang.perl.misc:

>There is a gentleman in Japan who is working on limited COM port
support for the djgpp-built version of Perl - but he has not yet
released results.


Any suggestions?


TIA,

--
David Christensen
dchristensen@california.com





  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 13 Aug 1999 23:23:59 GMT
From: jeromeo@atrieva.com (Jerome O'Neil)
Subject: Re: getting web page content
Message-Id: <7p29ef$u7l$1@brokaw.wa.com>

In article <37B49B65.F260E3C3@nospam.freakpress.com>,
	Jeremy Lassen <jlassen@NOSPAM.freakpress.com> writes:
> Are there any alternatives to these libraries that would work instead?
> any help would be appreciated.

LWP is the library you should seek.  It makes setting up custom 
user agents trivial.

-- 
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947 
The Atrieva Service: Safe and Easy Online Backup  http://www.i-filezone.com


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

Date: 13 Aug 1999 23:03:04 GMT
From: John Callender <jbc@shell2.la.best.com>
Subject: Re: Good Web Sites on Perl/DBI/MySQL?
Message-Id: <37b4a428$0$226@nntp1.ba.best.com>

Shannon Kurtas <clavikal@voicenet.com> wrote:
> I am in dire need of good documentation about the use of Perl with MySQL ( &
> DBI ). I have a small appendix-reference of DBI/Perl in my MySQL book...but
> I'm looking for something with more of a tutorial approach.

Here are a few URLs:

http://www.hotwired.com/webmonkey/backend/tutorials/tutorial1.html
http://www.devshed.com/Server_Side/MySQL/
http://eskimo.tamu.edu/~jbaker/dbi-examples.html
http://www.inlink.com/~perlguy/sql/

You might also check out the new O'Reilly book, at:

http://www.amazon.com/exec/obidos/ASIN/1565924347

or the sample chapter at:

http://www.oreilly.com/catalog/msql/chapter/ch10-beta.html

(though I'm not sure about the last URL, since there's some kind of
nasty route-flapping going on between alter.net and songline that's
preventing me from reaching it at the moment).

Hope that helps.

-- 
John Callender
jbc@west.net
http://www.west.net/~jbc/


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

Date: Fri, 13 Aug 1999 16:41:38 -0700
From: "David Christensen" <dchristensen@california.com>
Subject: Re: Help getting Perl to work on Windows 98
Message-Id: <37b4aaed@news5.newsfeeds.com>

Kevin and Andrea Werner wrote in message ...
>I cannot get Perl to run my CGI scripts under Windows 98. I can
run Perl
>scripts from the command line, and I can use PerlScript in ASP
pages.
>However, if I call a .pl file from the Address bar, Perl locks up.
I have
>the correct settings in my Registry's script map (I think), and I
have
>correctly set up my virtual directory (for Execute but not Read).
>
>Incidentally, something similar happens when I try to run PHP3
scripts.
>Instead of PHP crashing, however, I get an "HTTP/1.1 500 Server
Error"
>message.
>
>This really is frustrating me because I am sure that at one time I
had Perl
>running just fine. However, for some reason I had to rebuild my
system and
>everything went to hell.
>
>Any help would be appreciated.
>
>Thanks!


I downloaded and installed Sambar Server late last night
(www.sambar.com).  I think it comes with Perl binaries (?)  I fired
it up and played with it for about 5 minutes using IE, and it looks
really kewl  :-)  It includes a test Perl script in the cgi-bin
directory for displaying your environment, and it worked!

--
David Christensen
dchristensen@california.com






  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Fri, 13 Aug 1999 19:11:39 -0400
From: "Nikhil Daxini" <mnikhil@worldnet.att.net>
Subject: Limitation on number of rows fetched from database ?
Message-Id: <7p29mm$jg8$1@bgtnsc03.worldnet.att.net>

HiAll,
    I am using ODBC module to connect to INFORMIX 7.23 on HP-UX 10.23 from
NT server.
    I am preparing a select statement, selecting 10 fields from a table,
executing the statement and processing each row using the "while
(($variables....) = $sth->fetchrow(){...}". While loop abruptly exits before
processing all the rows.
    Number of rows processed increases if I reduce the number of the columns
selected. Is there is limitation on the buffer size available for
fetching/processing rows in the loop ?
    DBI Documentation talks about the database handle attribute
"RowCacheSize". Can someone provide some details about it, how to use it.

Any help will appreciated.
-Thanks
-Nikhil






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

Date: Fri, 13 Aug 1999 19:12:36 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: Looking for gibberish generator
Message-Id: <37B4A65F.EB834148@chaos.wustl.edu>

Kim Eggleston wrote:
 
> These Markov Chains... never heard of that.. what are they?

http://dimacs.rutgers.edu/~dbwilson/exact/

This might help. 

e.


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

Date: Fri, 13 Aug 1999 23:49:12 GMT
From: Brundle <brundlefly76@hotmail.com>
Subject: Major pack() gripe
Message-Id: <7p2atm$mqr$1@nnrp1.deja.com>

Why do I need to specify length($string) + 1 after the 'a' for every
null-terminated string I want packed?

Perl knows the length of my scalars, so why can't I just say 'a' and
have the function do this simple calculation?

This is the only part of my pack string I need to form dynamically. it
makes an already ugly coded string even more ugly.

Is there a more elegant way to do this?


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Fri, 13 Aug 1999 17:58:22 -0400 (EDT)
From: aroden@engin.umich.edu ("Joseph R. Wyrembelski")
Subject: Passing associative arrays to CGI scripts (perl)
Message-Id: <Pine.SOL.4.02.9908131746270.5587-100000@putt.engin.umich.edu>


Using forms, how would I go about passing the three
parameters 
 
  $number  -- which is a scalar
  *arrayOne -- which is an associative array
  *arrayTwo -- which is also an associative array
 
Currently, I am trying (and would like to) use
 
  <form method=POST action="script.pl?">
    <INPUT TYPE=hidden NAME= userData VALUE= *userData>
    <INPUT TYPE=hidden NAME= pathData VALUE= *pathData>
    <input type="text" name="number" size="20">
    <input type=Submit Value="Do Script">
  </form>

 
but when it gets to the script and executes the code:
 
%input = (); 
&ReadParse(*input);
local($number) = $input{'number'}; 
local(*userData) = $input{'userData'};
local(*pathData) = $input{'pathData'};

 
the two associative arrays appear empty though the number appears
fine!

Am I looking for the information incorrectly, or just passing it wrong.

I have read something somewhere about ".. multivalued [somethings] are
separated in the query string by \0.." but I am not sure if that is
correct or relevant.

Any help would be appreciated.

Thank you VERY much,

Joseph
aroden@engin.umich.edu
 






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

Date: 13 Aug 1999 23:05:05 GMT
From: "Noah Davids" <Noah_Davids@stratus.com>
Subject: perl for Windows CE 2.0?
Message-Id: <01bee5e0$0393b780$282c73c6@noah>

Is there a port of perl for Windows CE 2.0? If so where can I find it?


--------------------------------------
Serendipity is a function of bandwidth
Noah_Davids@stratus.com


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

Date: Fri, 13 Aug 1999 19:34:57 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: perl for Windows CE 2.0?
Message-Id: <37B4AB9B.CB7FC62D@chaos.wustl.edu>

Noah Davids wrote:
> Is there a port of perl for Windows CE 2.0? If so where can I find it?

Always check the ports page first http://www.cpan.org/ports/index.html
and, of course, http://www.activestate.com/.
Also, perl.com is your friend :) http://www.perl.com/reference/query.cgi?windows

e.


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

Date: Fri, 13 Aug 1999 23:47:14 GMT
From: "Shawn Grant" <tristar@direct.ca>
Subject: Perl Programmers' Web Design "Difficulties"
Message-Id: <682t3.48528$U42.82597@news1.rdc1.bc.home.com>

I don't mean to make a sweeping generalization, but it
appears that the more advanced programmers can't seem
to create attractive web sites. Not that this is an insult...we
all have our strengths and weaknesses. Maybe it's a left/right
brain thing. Lets look at some examples:

http://www.stonehenge.com
http://www.perl.org
http://www.tpj.com Perl Journal's was simple too, but now it forwards
to itknowledge.com (who probably staff web/graphic designers).
http://www.perl.com/CPAN

To be fair, http://www.perl.com looks good, as does
http://www.activestate.com

Perhaps web design is inversely proportional to programming skill.

Shawn.





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

Date: Fri, 13 Aug 1999 19:22:59 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: perl script for changing all upper case letters to lower case with  first word of sentence capitolized
Message-Id: <37B4A8CE.E12053AF@chaos.wustl.edu>

Dan and/or Shelly wrote:
> Does anyone have a perl script that will convert text that is in all
> uppercase to lowercase but still leave the first word of a sentence in upper
> case?

Have a look at the Perl FAQ and study the perlop man page. 

e.


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

Date: Fri, 13 Aug 1999 16:49:30 -0700
From: "David Christensen" <dchristensen@california.com>
Subject: Re: reference to object method
Message-Id: <37b4ac99@news5.newsfeeds.com>

Hello, World!

Thank you all for your help and suggestions  :-)  I've got things
working using closures and object reference passing.


--
David Christensen
dchristensen@california.com





  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 13 Aug 1999 23:28:46 GMT
From: lt lindley <ltl@rgsun5.viasystems.com>
Subject: Re: regular expression - counting words and quotes
Message-Id: <7p29ne$idq$1@rguxd.viasystems.com>

Bill Moseley <moseley@best.com> wrote:
:>I'm not here to ask what a 'word' is.  But I'm counting words with:

:>$_ = q[This is someone's "quoted" 'text'];

:>my %words;

:>$words{$1}++ while /([A-Za-z'_-]+)/g;
:>print "$_: $words{$_}\n" foreach keys %words;

:>I want "someone's" but I'd rather have "text" instead of "'text'".  Any 
:>way to do this within the regular expression?

I didn't look very hard, but I would expect that parsing of regular
English text is a problem space that has been addressed many times
before.  "quotewords()" from Text::ParseWords may be close enough to
satisfy you.  However, reinventing the wheel can be fun if it is just
to try to learn more about regexp.  :-)

My first shot off of the tee is hopefully in the fairway.

#!/usr/lib/lprgs/perl -w
use strict;

my (%words, $word, $count);

$_ = q{'first' Tis' This is "" '' someone's}
	. q{ 'tortured.'}
	. q{ 'turn of phrase'.}
	. q{ "quoted" 'text' Albert's 'bitchn'' 'last'};
# I think that proper English prose puts the period inside of
# double quotes when quoting a phrase, but are there rules
# for single quotes?  I'm going to fail on 'tortured.'

# I don't see how to do it with one regexp right off the bat,
# So first find the words enclosed in quotes and get rid of them
$words{$1}++ while s/(?<![A-Za-z'_-])	# Not a word char before me
		     '([A-Za-z'_-]+?)'	# min word surrounded by quotes
		     (?![A-Za-z'_-])	# Not followed by word char
		   //gx;

# Then pick up the ones that are left
$words{$1}++ while /([A-Za-z'_-]+)/g;

print "$word: $count\n" while (($word, $count) = each %words);
__END__
'tortured: 1
'turn: 1
someone's: 1
quoted: 1
Albert's: 1
last: 1
of: 1
': 1
Tis': 1
This: 1
phrase': 1
is: 1
'': 1

I fail my own torture tests so my first shot is in the rough.  This
probably fails lots of other tests too.  There is almost certainly a
way to do it that has already been done before.  Unless you are just
doing this for the fun of figuring it out, you might want to look a
little harder for what is already available.

-- 
// Lee.Lindley   /// Programmer shortage?  What programmer shortage?
// @bigfoot.com  ///  Only *cheap* programmers are in short supply.
////////////////////    50 cent beers are in short supply too.


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

Date: Fri, 13 Aug 1999 16:34:40 -0700
From: "David Christensen" <dchristensen@california.com>
Subject: Re: Spawning OS Command from Perl
Message-Id: <37b4a92c@news5.newsfeeds.com>

kiran dronamraju wrote in message
<01bee5d7$ced138e0$d2eae7cd@dronamk>...
>Env.
>Active Perl V5.18
>Windows NT Server 4.0 SP 4
>
>Trying to execute the following code with failure. Please help
>
>@args=('notepad',' c:\perl\a.txt');
>system(@args);
>
>Doesnt work. It works fine on an NTWorkstation and Windows95.
>thank you.


Kiran:

Maybe it's the \p and \a (?)  Have you tried \\ ?


>Doesnt work.

If \\ doesn't do it, then please provide more details so someone
can help you.  :-)


David Christensen
dchristensen@california.com





  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 13 Aug 1999 16:26:12 PDT
From: Joby <jsb@electron-alchemy.com>
Subject: This code is killing me!!! Help!
Message-Id: <37B4A87C.EC39AB90@electron-alchemy.com>

I have a program that will jump to a URL depending on the code you enter.
It logs the attempt and jumps to the URL.

This program asks for a code and counts how many times it has been entered
in the above program.  When 'all' is entered it should list each of the
codes and count each use.  The single code works, the 'all' part doesn't...
it simply gives a value of '0' for each code.  As far as I've been able to
track down, the '@results' is, and stays, empty just for a code of 'all'.

Can any one help???

----------------------------------
sub main_page {
if ($offer eq "all"){
open(CID,"emailcid.txt") || die $!;
  while(<CID>){
  s/(.*)::(.*)/\1/;
  push @cids, $_;
  }
close(CID);

foreach $cida (sort @cids) {
$totalnum = &counter($cida);
print "$cida = $totalnum <br>";
}

}
else {
$totalnum = &counter($offer);
print "Offer Code : $offer = $totalnum <br>";
}
}

sub counter {
  my @results;
  my $test = 0;
  open(OFFERDATA,"emailcnt.txt") || die $!;
    while(<OFFERDATA>){
      if(/$_[0]/oi){push @results, $test}
    }
  close(OFFERDATA);
  $totalnums = @results;
  return $totalnums;
}


--
Joby Bednar





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

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

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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu. 

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


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