[19486] in Perl-Users-Digest
Perl-Users Digest, Issue: 1681 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Sep 2 18:10:31 2001
Date: Sun, 2 Sep 2001 15:10:12 -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: <999468612-v10-i1681@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 2 Sep 2001 Volume: 10 Number: 1681
Today's topics:
Re: Is there a better way of righting this... (TuNNe|ing)
Re: Is there a better way of righting this... <info@fruiture.de>
Re: Is there a better way of righting this... <gnarinn@hotmail.com>
Re: Net::Telnet.pm and the Escape Key <matze@e-travel.de>
Re: Performance : Shell X Perl (Seymour J.)
Re: POD2Doc? <kevin@vaildc.net>
Re: POD2Doc? (Jonadab the Unsightly One)
Re: POD2Doc? <dtweed@acm.org>
Re: Posting a pre-existing cookie using LWP? <gnarinn@hotmail.com>
Recommendations for a PERL editor (RoJo)
Re: Recommendations for a PERL editor (TuNNe|ing)
Re: Recommendations for a PERL editor (RoJo)
Re: Recommendations for a PERL editor <sabin@cornhusker.net>
Re: Recommendations for a PERL editor <info@fruiture.de>
Re: Recommendations for a PERL editor (Jonadab the Unsightly One)
Re: Recommendations for a PERL editor <vze2r2j8@verizon.net>
Re: Recommendations for a PERL editor <sabin@cornhusker.net>
Re: Recommendations for a PERL editor <gnarinn@hotmail.com>
Re: Script not reading templates - why?? <gbirchley@hotmail.com>
Re: Script not reading templates - why?? <samneric@tigerriverOMIT-THIS.com>
Re: Script not reading templates - why?? <krahnj@acm.org>
Re: Simple RegExp Question (Sam)
Re: Structuring a program (if statements) (Seymour J.)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 02 Sep 2001 20:23:19 GMT
From: troll@gimptroll.com (TuNNe|ing)
Subject: Re: Is there a better way of righting this...
Message-Id: <3b9288cc.37881822@news.coserv.net>
On Sun, 02 Sep 2001 16:47:30 +0100, kdgjloiureo <noone@none.com>
wrote:
>Right im fairly new to perl and im sure there must be a better way of
>righting the sub below any one have any ideas as to how to make this a
>bit more efficient.
>
here is my attempt. there is probably an even better way to do it, and
i look forward to seeing my code ripped by the gurus, because it's all
part of the learning experience.
I made up a routine for your print_resualts_gen() since you didn't
provide it. All i do is print the $dir, $display, and $price vars to
STDOUT.
Regards,
Jason
my perl playground -> http://www.gimptroll.com
_begin code here_
#!/usr/bin/perl -w
use strict;
my %FORM;
my $third_del = 3;
my $dir;
my $display;
my $price;
my @valid_list = qw(/home/closey/secure/dBs/CDR/
/home/closey/secure/dBs/Phone/); #list of valid selections
#call print_record with a valid choice
$FORM{'select'} = "/home/closey/secure/dBs/Phone/";
print_record($FORM{'select'});
#call print_record with an ivalid choice
$FORM{'select'} = "/home/closey/secure/dBs/IJUSTDONtkNo/";
print_record($FORM{'select'});
exit;
#begin print_record subroutine
sub print_record {
my $form_selection = shift;
if (validate($form_selection)) {
$form_selection =~ m!.+/(\w+)/$!;
print "$1\n";
setvars($1);
} else {
setvars("all")
}
print_resualts_gen();
sub setvars {
my $selection = shift;
$dir = "../$selection/";
$display = "$selection";
$price = sprintf("%.2f", ($third_del / 1.175));
}
sub validate {
my $key = shift;
foreach (@valid_list) {
if ($_ eq $key) {
return(1);
}
}
return(0);
}
sub print_resualts_gen {
print "$dir\n$display\n$price\n";
}
}
_end code here_
------------------------------
Date: Sun, 2 Sep 2001 21:05:01 +0200
From: "fruiture" <info@fruiture.de>
Subject: Re: Is there a better way of righting this...
Message-Id: <9mu0bq$a3v$04$1@news.t-online.com>
"kdgjloiureo" <noone@none.com> wrote:
> Right im fairly new to perl and im sure there must be a better way of
> righting the sub below any one have any ideas as to how to make this a
> bit more efficient.
usally it helps to
use strict and warnings
and to read
% perldoc perlstyle
% perldoc perlsyn
--
require Time::HiRes;my @m=split(/8/,55.52.56.49.49.55.56.49.49.53);push
@m,map{($_%2)?$_-1:$_+1} map ord($_),split//,'u!`onuids!Qdsm!i`bjds';
unshift @m,43 for(0..@m);for(0..@m){print map chr($_),@m[0..(@m/2-1)];
push @m,shift @m;print "\b"x(@m/2);Time::HiRes::usleep(0246*0xA**3);}
------------------------------
Date: Sun, 2 Sep 2001 20:45:06 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: Is there a better way of righting this...
Message-Id: <999463506.742625185288489.gnarinn@hotmail.com>
In article <vrk4ptkfaeeeq81f0t1tmf07pmpj405257@4ax.com>,
kdgjloiureo <noone@none.com> wrote:
>Right im fairly new to perl and im sure there must be a better way of
>righting the sub below any one have any ideas as to how to make this a
>bit more efficient.
(snipped giant case statement)
looks like a prime target for a hash, as usual
%sel=(
CD => ["../CD/","CD's"],
CDR => ["../CDR/","CD RW's"],
Phone => ["../Phone/","Phones"],
accessories => ["../accessories/","Accessories"],
# and so on. you finish it yourself ....
);
sub print_record {
if (($FORM{'select'} =~ m[^/home/closey/secure/dBs/(.+)/$])
&& exists $sel{$1}) {
($dir,$display) = @{$sel{$1}};
} else {
$dir = "../all/";
$display = "All";
}
$price = $third_del / 1.175;
$price2 = sprintf("%.2f", $price);
&print_resualts_gen;
}
gnari
------------------------------
Date: Sun, 02 Sep 2001 20:04:51 +0200
From: Matthias Wegener <matze@e-travel.de>
Subject: Re: Net::Telnet.pm and the Escape Key
Message-Id: <3B9274C3.430712E6@e-travel.de>
Garry Williams wrote:
> What's wrong with $telnet->cmd(chr 0x1b); ?
= )
It works (now)! Additionally I had to set
Output_record_separator => ""
Otherwise he sends an 0x0a 0x0d along with the 0x1b and that is something the
application on the other end doesnt like :)
Thank you for your suggestion and everybody else for their additional help!
so long
Matthias Wegener
------------------------------
Date: Sun, 02 Sep 2001 01:38:24 -0400
From: "Shmuel (Seymour J.) Metz" <spamtrap@library.lspace.org.invalid>
Subject: Re: Performance : Shell X Perl
Message-Id: <3b91c5d1$2$fuzhry$mr2ice@news.patriot.net>
In <3I0j7.10$De6.3375@news0.optus.net.au>, on 08/29/2001
at 05:19 PM, "Knob" <andrew.savige@ir.com> said:
>My current approach is to bundle Perl v5.6.1,say, (along with extra
>modules) with our product and have the installation sh script unpack
>this distribution.
I'd consider that unacceptable unless the script is smart enough to
check what is already installed and to get confirmation before
installing a new version
--
-----------------------------------------------------------
Shmuel (Seymour J.) Metz, SysProg and JOAT
Atid/2
Team OS/2
Team PL/I
Any unsolicited commercial junk E-mail will be subject to legal
action. I reserve the right to publicly post or ridicule any
abusive E-mail.
I mangled my E-mail address to foil automated spammers; reply to
domain acm dot org user shmuel to contact me. Do not reply to
spamtrap@library.lspace.org
-----------------------------------------------------------
------------------------------
Date: Sun, 02 Sep 2001 12:03:18 -0400
From: Kevin Michael Vail <kevin@vaildc.net>
Subject: Re: POD2Doc?
Message-Id: <020920011203189394%kevin@vaildc.net>
In article <Xns91101BBC7113Brock13com@64.8.1.227>, Rob - Rock13.com
<rob_13@excite.com> wrote:
> I can't see the point in converting to a Word document--why create
> something that bloated and proprietary out of something that is
> simple.
Well, maybe internal standards call for documentation in Word format.
I had to do something similar for an internal application recently
because there was no way I was going to get the end users to know how
to look at POD (the program had to be distributed by running it through
perl2exe first, even).
In the general scheme of things, I agree with you, though.
--
Kevin Michael Vail | a billion stars go spinning through the night,
kevin@vaildc.net | blazing high above your head.
. . . . . . . . . | But _in_ you is the presence that
. . . . . . . . . | will be, when all the stars are dead. (Rainer Maria Rilke)
------------------------------
Date: Sun, 02 Sep 2001 18:29:42 GMT
From: jonadab@bright.net (Jonadab the Unsightly One)
Subject: Re: POD2Doc?
Message-Id: <3b927a23.23964663@news.bright.net>
"Rob - Rock13.com" <rob_13@excite.com> wrote:
> I can't see the point in converting to a Word document--why create
> something that bloated and proprietary out of something that is
> simple.
POD2HTML, OTOH, would make sense.
Personally I like my documentation as plain text so I can
view it in the One True Text Editor/Viewer.
- jonadab
------------------------------
Date: Sun, 02 Sep 2001 18:56:05 GMT
From: Dave Tweed <dtweed@acm.org>
Subject: Re: POD2Doc?
Message-Id: <3B927F7F.DBD09ED8@acm.org>
Jonadab the Unsightly One wrote:
> POD2HTML, OTOH, would make sense.
... and Word will quite happily read in an HTML file. You can even
save it as a .DOC file if you really want to.
If you need to do this in a batch mode, though, I don't know how to
do that.
-- Dave Tweed
------------------------------
Date: Sun, 2 Sep 2001 18:18:46 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: Posting a pre-existing cookie using LWP?
Message-Id: <999454726.828969580121338.gnarinn@hotmail.com>
In article <3B92245F.BAE87875@mail.verizon.net>, <vze2nddi@verizon.net> wrote:
>gnari wrote:
>
>> did you look at the HTTP::Cookies::Netscape subclass of HTTP::Cookies
>> the docs seem to indicate that such an object can read netscape cookie files.
>
>Yes, but I don't want to read an existing cookie file, because I need to run this
>on a couple of different machines, so I am trying to set the cookie as a string,
>instead of reading from a file.
I meant that you could copy your netscape cookiefile, edit it to only leave
the cookies you want, and keep that cookie file with your script.
if you do not want a separate cookiefile, you can generate a tempfile
each time you run:
open(COOK,"> cook") or die "argh! $!";
print COOK ".somedomain.com\tTRUE\t/\tFALSE\t1015517899"
. "\tZZZZ\t6d6f6e0931096d646179093609796561720931393934";
close(COOK);
$cookie_jar = HTTP::Cookies::Netscape->new(
File => "cook", AutoSave => 1 );
or something similar.
gnari
------------------------------
Date: Sun, 02 Sep 2001 16:43:58 GMT
From: rojo@mindspring.com (RoJo)
Subject: Recommendations for a PERL editor
Message-Id: <3b926160.358347636@news.mindspring.com>
I'm new to PERL. I keep getting "The page cannot be displayed" when I
use Windows 2000's Notepad to edit my scripts. An ISP support person
tells me it has syntax errors that are introduced by the editor.
Can someone recommend to me a reliable Windows-based editor that WON'T
create these problems for me ???
My email address is rojo@mindspring.com
------------------------------
Date: Sun, 02 Sep 2001 19:03:43 GMT
From: troll@gimptroll.com (TuNNe|ing)
Subject: Re: Recommendations for a PERL editor
Message-Id: <3b92826b.36248892@news.coserv.net>
On Sun, 02 Sep 2001 16:43:58 GMT, rojo@mindspring.com (RoJo) wrote:
>Can someone recommend to me a reliable Windows-based editor that WON'T
>create these problems for me ???
http://www.textpad.com
>My email address is rojo@mindspring.com
------------------------------
Date: Sun, 02 Sep 2001 17:44:13 GMT
From: rojo@mindspring.com (RoJo)
Subject: Re: Recommendations for a PERL editor
Message-Id: <3b926fd0.362043651@news.mindspring.com>
Thanks! I'll give it a whirl.
On Sun, 02 Sep 2001 19:03:43 GMT, troll@gimptroll.com (TuNNe|ing)
wrote:
>On Sun, 02 Sep 2001 16:43:58 GMT, rojo@mindspring.com (RoJo) wrote:
>
>>Can someone recommend to me a reliable Windows-based editor that WON'T
>>create these problems for me ???
>
>http://www.textpad.com
>
>>My email address is rojo@mindspring.com
>
------------------------------
Date: Sun, 2 Sep 2001 12:38:08 -0500
From: "sabin" <sabin@cornhusker.net>
Subject: Re: Recommendations for a PERL editor
Message-Id: <3b92703a_1@Usenet.com>
> Can someone recommend to me a reliable Windows-based editor that WON'T
> create these problems for me ?
Yep.
http://www.jgsoft.com
or if you want a good editor that has nice systax hilighting and macros...
try http://www.nedit.org/download/win32.shtml you will have to install some
things first. Nedit is my favorite editor but it may not be the best for
you. Take a look.
All are free and nedit is open source.
Frederick out.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
------------------------------
Date: Sun, 2 Sep 2001 20:59:04 +0200
From: "fruiture" <info@fruiture.de>
Subject: Re: Recommendations for a PERL editor
Message-Id: <9mu00k$poc$05$1@news.t-online.com>
"RoJo" <rojo@mindspring.com> wrote:
> I'm new to PERL. I keep getting "The page cannot be displayed" when I
> use Windows 2000's Notepad to edit my scripts. An ISP support person
> tells me it has syntax errors that are introduced by the editor.
>
> Can someone recommend to me a reliable Windows-based editor that WON'T
> create these problems for me ???
try german freeware: http://homepages.fh-giessen.de/~hg8444/proton3.exe of
ully meybohm (http://meybohm.de)
--
require Time::HiRes;my @m=split(/8/,55.52.56.49.49.55.56.49.49.53);push
@m,map{($_%2)?$_-1:$_+1} map ord($_),split//,'u!`onuids!Qdsm!i`bjds';
unshift @m,43 for(0..@m);for(0..@m){print map chr($_),@m[0..(@m/2-1)];
push @m,shift @m;print "\b"x(@m/2);Time::HiRes::usleep(0246*0xA**3);}
------------------------------
Date: Sun, 02 Sep 2001 19:09:18 GMT
From: jonadab@bright.net (Jonadab the Unsightly One)
Subject: Re: Recommendations for a PERL editor
Message-Id: <3b927e68.25058400@news.bright.net>
rojo@mindspring.com (RoJo) wrote:
> Can someone recommend to me a reliable Windows-based editor that WON'T
> create these problems for me ???
Several choices, in increasing order of power:
PFE (Programmer's File Editor) is free and "feels" like Notepad,
until you look in the options menu and see that there are a lot
more options than in Notepad. If your needs are pretty simple,
and you don't want to spend time learning to use an editor, this
is for you.
UltraEdit adds features like syntax highlighting (which IMO
is a must-have feature for editing Perl code), but it is
shareware. It feels like a regular Windows app. I don't
remember how much the registration fee is.
vim is free, has syntax highlighting and a number of other
features, but doesn't feel a *thing* like a regular Windows
app; there's a real learning curve, but it is powerful.
(vim itself comes from the Amiga world, OSIAT, but it's
based on vi, which is an old Unix thing. There are ports
available for NT and for Windows).
Emacs is the ultimate. Multiple megabytes of text-editing
power, it has thousands of features you'll probably never
need (browse the web, play music, brew coffee...), and is
fully scriptable so you can write your own features (if you
learn lisp). Emacs is free. It does have a learning curve,
however, and it is addictive. For a Windows system, you'd
want NTEmacs. (Emacs is old, older than Unix even, although
it was reimplemented from scratch a few versions ago.
Version 21 is due out any year now and promises to be even
better than version 20.)
- jonadab
------------------------------
Date: Sun, 02 Sep 2001 19:20:44 GMT
From: "Kurt Stephens" <vze2r2j8@verizon.net>
Subject: Re: Recommendations for a PERL editor
Message-Id: <gEvk7.2670$mC2.1543775@typhoon2.gnilink.net>
"RoJo" <rojo@mindspring.com> wrote in message
news:3b926160.358347636@news.mindspring.com...
>
> I'm new to PERL. I keep getting "The page cannot be displayed" when I
> use Windows 2000's Notepad to edit my scripts. An ISP support person
> tells me it has syntax errors that are introduced by the editor.
>
> Can someone recommend to me a reliable Windows-based editor that WON'T
> create these problems for me ???
>
> My email address is rojo@mindspring.com
Regardless of which editor you use, you will still have problems if you try
to transfer files from a Win32 machine to a Unix host without translating
the line terminator from [CR/LF] to [LF]. Your FTP client will take care of
this if you make sure to transfer the file in text mode. Of course, some of
the editors mentioned, such as TextPad, will allow you to edit the files in
either Unix, Mac or PC format, as well as translating files that have been
mangled during transfer.
Then again, maybe your syntax errors are really syntax errors. Try
connencting to your server via Telnet and type perl -wc scriptname and see
what happens.
HTH,
Kurt Stephens
------------------------------
Date: Sun, 2 Sep 2001 14:24:53 -0500
From: "sabin" <sabin@cornhusker.net>
Subject: Re: Recommendations for a PERL editor
Message-Id: <3b928912_8@Usenet.com>
> UltraEdit adds features like syntax highlighting (which IMO
> is a must-have feature for editing Perl code), but it is
> shareware. It feels like a regular Windows app. I don't
> remember how much the registration fee is.
Its $30. I've used it. Its 'ok' but seems to crash on me about every hour
or so.
I would say with better free tools avalible why bother but thats just my op.
I've started doing all my development on Linux ( Much better but maybe I'm
bias).
> vim is free, has syntax highlighting and a number of other
> features, but doesn't feel a *thing* like a regular Windows
> app; there's a real learning curve, but it is powerful.
> (vim itself comes from the Amiga world, OSIAT, but it's
> based on vi, which is an old Unix thing. There are ports
> available for NT and for Windows).
Vim is great :-). My first computer was an Amiga.
> Emacs is the ultimate. Multiple megabytes of text-editing
> power, it has thousands of features you'll probably never
> need (browse the web, play music, brew coffee...), and is
> fully scriptable so you can write your own features (if you
> learn lisp). Emacs is free. It does have a learning curve,
> however, and it is addictive. For a Windows system, you'd
> want NTEmacs. (Emacs is old, older than Unix even, although
> it was reimplemented from scratch a few versions ago.
> Version 21 is due out any year now and promises to be even
> better than version 20.)
Nothing to say here.
Frederick out.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
------------------------------
Date: Sun, 2 Sep 2001 20:56:13 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: Recommendations for a PERL editor
Message-Id: <999464173.0449179094284773.gnarinn@hotmail.com>
In article <3b926160.358347636@news.mindspring.com>,
RoJo <rojo@mindspring.com> wrote:
>
>I'm new to PERL. I keep getting "The page cannot be displayed" when I
>use Windows 2000's Notepad to edit my scripts. An ISP support person
>tells me it has syntax errors that are introduced by the editor.
if you mean by this that you edit your scripts on the PC, and ftp
them to the server, and the server is not Windows. then your
problem is probably that you are not using -w in the shebang line:
#!/usr/bin/perl -w
actually the real reason is that your PC uses CRLF as line terminators,
but the server uses LF.
the solution to this is to either:
a) ftp the file in text mode, not binary
b) install unix on your pc, and forget about windows
c) remove the CRs from the script, before or after transfer
d) use -w on the shebang line, as that fixes the most common problem
(but not all)
e) there might possibly be some editor on windows that does not
use CRs
gnari
------------------------------
Date: Fri, 31 Aug 2001 20:31:39 +0100
From: "Gifford Birchley" <gbirchley@hotmail.com>
Subject: Re: Script not reading templates - why??
Message-Id: <%Rrk7.27291$wX5.3331194@news6-win.server.ntlworld.com>
Done the whingeing. Read the documentation (short 'readme' file). Spent 2
days on the phone to Network Solutions. They only have one Perl consultant -
nice lass, but not able to help much - she's as puzzled as me. Me, I'm just
some poor schmuck who has to get this stuff running. I can hack elementary
Perl, but trying to troubleshoot this lot is going to take me forever. Got
to the point where I think I must be losing my few remaining marbles. I'm
not in the habit of asking for help - I like to solve my own problems. Any
assistance from my elders and betters is humbly and gratefully appreciated
:)
"Martien Verbruggen" <mgjv@tradingpost.com.au> wrote in message
news:slrn9otl0v.1jv.mgjv@verbruggen.comdyn.com.au...
> On Thu, 30 Aug 2001 11:20:07 +0100,
> Gifford Birchley <gbirchley@hotmail.com> wrote:
> > I have a Perl application from Network Solutions - ISP Tools v1.3 -
which
>
> And what does the support department of Network Solutions have to say
> about this problem? Or don't they offer support?
>
> What does the documentation say about this? Does it say you have to do
> anything after 'installing' new templates? Or is there no
> documentation?
>
> Maybe you should whinge to Network Solutions.
>
> > reads in a set of templates and returns formatted web pages to STDOUT.
The
> > templates are supposed to be editable to customise the HTML output.
Problem
> > is, the script seems to be reading in the templates first time it runs,
and
> > then ignoring them from then on. I can edit, move or delete the
templates -
> > no change! Even rebooting - no change!! I am running RH Linux 7.1,
>
> Sounds like caching to me. I'd look for cached copies somewhere, and
> delete them. If it is caching, then I'd say it is behaving pretty
> dumb, or you're not doing what you're supposed to do when updating
> templates.
>
> Martien
> --
> Martien Verbruggen |
> Interactive Media Division | Never hire a poor lawyer. Never buy
> Commercial Dynamics Pty. Ltd. | from a rich salesperson.
> NSW, Australia |
------------------------------
Date: Sun, 2 Sep 2001 11:35:29 -0400
From: Samneric <samneric@tigerriverOMIT-THIS.com>
Subject: Re: Script not reading templates - why??
Message-Id: <MPG.15fc1bc85bf25d09896aa@news.onemain.com>
Gifford Birchley wrote:
> I can hack elementary
> Perl, but trying to troubleshoot this lot is going to take me forever. Got
> to the point where I think I must be losing my few remaining marbles. I'm
> not in the habit of asking for help - I like to solve my own problems. Any
> assistance from my elders and betters is humbly and gratefully appreciated
Suppose you publish the URL to where these tools are available for download, so
that those whom you are asking for help can also see what you're looking at. I
did a websearch on "ISP Tools v1.3" and didn't get any hits that led to
scripts.
Otherwise, you're not going to get much more than guesses here.
------------------------------
Date: Sun, 02 Sep 2001 19:21:31 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Script not reading templates - why??
Message-Id: <3B928731.7D929933@acm.org>
Samneric wrote:
>
> Gifford Birchley wrote:
> > I can hack elementary
> > Perl, but trying to troubleshoot this lot is going to take me forever. Got
> > to the point where I think I must be losing my few remaining marbles. I'm
> > not in the habit of asking for help - I like to solve my own problems. Any
> > assistance from my elders and betters is humbly and gratefully appreciated
>
> Suppose you publish the URL to where these tools are available for download, so
> that those whom you are asking for help can also see what you're looking at. I
> did a websearch on "ISP Tools v1.3" and didn't get any hits that led to
> scripts.
>
> Otherwise, you're not going to get much more than guesses here.
http://www.networksolutions.com/en_US/partners/isptools/index.html;jsessionid=XHX4X3WJKCTIBWFI3EGCFEY
According to the page you have to be a Network Solutions "partner" in
order to download them.
John
--
use Perl;
program
fulfillment
------------------------------
Date: Sun, 02 Sep 2001 15:15:55 -0500
From: sam_5_5_5_0@REMOVEyahoo.com (Sam)
Subject: Re: Simple RegExp Question
Message-Id: <sam_5_5_5_0-0209011515550001@dialup-702.deskmedia.com>
In article <6lhk7.53267$hT4.13294054@news1.rdc1.md.home.com>, "David
Hilsee" <davidhilseenews@yahoo.com> wrote:
> "Sam" <sam_5_5_5_0@REMOVEyahoo.com> wrote in message
> news:sam_5_5_5_0-0109012158330001@dialup-740.deskmedia.com...
> > In article <v_gk7.53142$hT4.13273240@news1.rdc1.md.home.com>, "David
> > Hilsee" <davidhilseenews@yahoo.com> wrote:
> >
> > > "Sam" <sam_5_5_5_0@REMOVEyahoo.com> wrote in message
> > > news:sam_5_5_5_0-0109011943070001@dialup-721.deskmedia.com...
> > > > I need a regular expression to help analize a file that contains
> > > > statistics for game. The data contains a level name and a number, as
> > > > follows (for example):
> > > >
> > > > Hawthorne 3 Zamboni
> > > 1
> > > > Heimdall 1
> > > >
> > > > Note that there are two ways it could be on a line:
> > > >
> > > > -2 on a line
> > > > -1 on a line
> > > >
> > > > Here's the script (part of it):
> > > >
> > > > while() {
> > > > chomp($in = <>);
> > > > if ($in =~ /<exp1>/) {
> > > > $levels{$1}+=$2;
> > > > $levels{$3}+=$3;
> > > > } elsif ($in =~ /<exp2>/) {
> > > > $levels{$1}+=$2;
> > > > } elseif ($in =~ /^$/) {
> > > > print "end of list";
> > > > last;
> > > > }
> > > > }
> > > >
> > > > where <exp1> and <exp2> are the regular expressions. In the first, $1
> and
> > > > $3 are level names, and $2 and $4 are the numbers. In the second, $1
> is
> > > > the name and $2 is the number.
> > > >
> > > > Note that level names can contain pucuation, spaces, ect.
> > > >
> > > > Any help would be nice. Thanks.
> > > >
> > > > --
> > > > Remove "REMOVE" for address to reply.
> > > > I don't check that mailbox very often.
> > > > Replies to the newsgroup are best.
> > >
> > > The only thing I could gather from your description is that whitespace
> and
> > > digits are the only ways to distinguish parts of the line. What I came
> up
> > > with doesn't follow the same form as yours does, but I figure it might
> be
> > > what you are looking for.
> > >
> > > #!/usr/bin/perl -w
> > > use strict;
> > >
> > > my %levels;
> > > while ( <DATA> )
> > > {
> > > # The first non-whitespace character starts the name.
> > > # The name continues until a series of spaces followed by
> > > # a series of digits is reached (the number)
> > > my %temp_levels = /(\S.*?)\s+(\d+)/g;
> > >
> > > while ( my ($k,$v) = each %temp_levels )
> > > {
> > > $levels{$k} += $v;
> > > }
> > > }
> > >
> > > while ( my ($k,$v) = each %levels )
> > > {
> > > print "$k => $v\n";
> > > }
> > >
> > > __DATA__
> > > Hawthorne 3 Zamboni
> > > 1
> > > Heimdall 1
> > > some stuff laksjdf 2 other things asdf 4
> > > yea, that's it 42 once again 5
> > > once again #2 98
> > > once again 3
> > > Heimdall 3
> > > yea, that's it 54 other things asdf 32
> > >
> > >
> > >
> > > David Hilsee
> >
Thanks for the help, but I may have come up with my own solution. Since
the lines are all the same length, I can use substr...
(I think it is much easier to understand code you write yourself.)
Again, thanks.
--
Remove "REMOVE" for address to reply.
I don't check that mailbox very often.
Replies to the newsgroup are best.
------------------------------
Date: Sun, 02 Sep 2001 12:34:28 -0400
From: "Shmuel (Seymour J.) Metz" <spamtrap@library.lspace.org.invalid>
Subject: Re: Structuring a program (if statements)
Message-Id: <3b925f94$1$fuzhry$mr2ice@news.patriot.net>
In <9ls6or$bpr$1@neptunium.btinternet.com>, on 08/21/2001
at 12:34 AM, "Peter Mann" <Pcmann1@btinternet.com> said:
>In C, there is a case statement, but i can't find similar method in
>my Perl book!
What book? The camel explicitly says that there is none. O'Reilly is
your friend.
I'm new to Perl, but off the top of my head try
{
if (condition1) {action1;last};
if (condition2) {action2;last};
if (condition3) {action3;last};
if (condition4) {action4;last};
alternateaction
};
--
-----------------------------------------------------------
Shmuel (Seymour J.) Metz, SysProg and JOAT
Atid/2
Team OS/2
Team PL/I
Any unsolicited commercial junk E-mail will be subject to legal
action. I reserve the right to publicly post or ridicule any
abusive E-mail.
I mangled my E-mail address to foil automated spammers; reply to
domain acm dot org user shmuel to contact me. Do not reply to
spamtrap@library.lspace.org
-----------------------------------------------------------
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 1681
***************************************