[16232] in Perl-Users-Digest
Perl-Users Digest, Issue: 3644 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 12 21:05:33 2000
Date: Wed, 12 Jul 2000 18:05:14 -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: <963450314-v9-i3644@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 12 Jul 2000 Volume: 9 Number: 3644
Today's topics:
*** Shared access to global variables !!! *** <whofer@access.ch>
Re: Accessing WinNT/9x environment variables (jason)
Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!! (Craig Berry)
Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!! (Craig Berry)
Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!! (Eric Bohlman)
Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!! (Eric Bohlman)
Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!! <nnickee@nnickee.com>
Re: ATTENTION PERL MEATHEADS!!!!!!!!!!!!!!!!!!! (Craig Berry)
Beginner with simple question on searching <fattahipourNOfaSPAM@usa.net.invalid>
Re: Beginner with simple question on searching (Tad McClellan)
binary to decimal conversion bmenon@my-deja.com
Re: binary to decimal conversion <lr@hpl.hp.com>
Re: binary to decimal conversion <juex@deja.com>
Re: Bit shifting...should be exponentiation <sb@muccpu1.muc.sdm.de>
calling Java methods / classes <arifsaha@yahoo.com>
command line input (BFisher244)
Re: command line input (NP)
Re: Error from unsupported lookbehind <peterbe@home.com>
Getopt::Long gripes <occitan@esperanto.org>
Help, no cgi push! what else is there? richardstands@my-deja.com
Re: if...elsif...else question (jason)
Re: Looping(loop operator?) <prakash@seminole.gate.net>
Re: Looping(loop operator?) (Tad McClellan)
Re: matching a block of text through RE. (jason)
Re: metrics (Tad McClellan)
Re: Need Help with array (should be easy!) (Abigail)
parsing CSV file <kolya3@rocketmail.com>
Re: parsing CSV file (NP)
Re: Perl-Access (jason)
Re: Perl... the split function <nnickee@nnickee.com>
Re: PRINTing " "" " (Abigail)
Problems with reading and printing file! <arild@langtind.no>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 13 Jul 2000 00:24:27 +0100
From: "Werner Hofer" <whofer@access.ch>
Subject: *** Shared access to global variables !!! ***
Message-Id: <8kir4k$c5p$1@pacifica.access.ch>
Hi
how can i access from 2 Perl Scripts to shared global variables ????
Is it possible ? ( i need it, when i will show n entries from a web
database,
the use click NEXT and now i have to show the next n entries ...and so on )
Thanks a lot for your help
Werner
------------------------------
Date: Thu, 13 Jul 2000 00:17:43 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: Accessing WinNT/9x environment variables
Message-Id: <MPG.13d7a7ef451c8db7989689@news>
Craig Conway wrote ..
> I'm writing an installer in Perl and want to update the %PATH variable
>under WinNT/98/95.
>
> How do you permanently modify an environmental variable under WinNT? Is
>there a method that will also work under Win95/8 or do I just have to search
>and replace in autoexec.bat for those two OS's?
can't speak for Win9x .. because I don't have a machine here to check it
out on .. but in WinNT the envars are kept in the registry .. and
adjusting them in there will adjust them permanently (which can be done
with one of the standard modules Win32::TieRegistry or Win32::Registry
but - if you're in a position to use other modules then you don't need
to worry about the specific code to do that .. Roth Consulting has done
it for you
the DelEnvVar and SetEnvVar methods on Win32::AdminMisc from
http://www.roth.net/ will do what you want very neatly .. they might
even magically work differently on Win9x .. dunno
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Wed, 12 Jul 2000 22:11:43 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!!
Message-Id: <smpr8v5gnd650@corp.supernews.com>
Jeff H (jeffahill@lucent.com) wrote:
: But the books that Randall
That's "Randal". I believe his middle name is "=~ tr/a-z//s".
--
| Craig Berry - http://www.cinenet.net/users/cberry/home.html
--*-- "Beauty and strength, leaping laughter and delicious
| languor, force and fire, are of us." - Liber AL II:20
------------------------------
Date: Wed, 12 Jul 2000 22:13:20 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!!
Message-Id: <smprc088nd645@corp.supernews.com>
p3rlc0dr@my-deja.com wrote:
: NO ITS NOT. RANDAL IS JAIL. MATT IS NICE.
Isn't the next one WAR IS PEACE?
--
| Craig Berry - http://www.cinenet.net/users/cberry/home.html
--*-- "Beauty and strength, leaping laughter and delicious
| languor, force and fire, are of us." - Liber AL II:20
------------------------------
Date: 12 Jul 2000 22:19:39 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!!
Message-Id: <8kiqtr$10c$4@nntp9.atl.mindspring.net>
Young H Lee (yhlee@mail.med.upenn.edu) wrote:
: : I'll bite, even though this "I don't speak good english" crap is a
: : bit tired. Your usage and grammer are markedly worse in every
: : subsequent post you make. You started out using common slang and
: : mixed case haXor speak, and now you have degraded into some kind of
: : Godzilla movie psuedo-english.
: : ^^^^^^^^
:
: In her defense, a lot of the foreigners out there who learn a little bit
: of english in high school/college/whatever and learn the rest "as they go
: along" on the internet pick up what they see, which include slang/haxor (I
: cant say i know exactly what haxor is) speak. I've spoken/written with
: several koreans and heck, they know more slang than I do.
But the original poster's point was that Our Hero's command of English
seemed to be getting worse and worse with each post, whereas most
people's command of a second language *improves* the more they use it.
P.S. "HaXor" = "kewl" spelling of "hacker."
------------------------------
Date: 12 Jul 2000 22:23:25 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!!
Message-Id: <8kir4t$10c$5@nntp9.atl.mindspring.net>
The WebDragon (nospam@nospam.com) wrote:
: In article <8khv9d$if9$1@nnrp1.deja.com>, p3rlc0dr@my-deja.com wrote:
: | How do you know I dont know how to write Perl program? QUIT BEING
: | MEAN. YOUR STALKING ME!
:
: are you SURE they aren't in cahoots? (:
Has anyone noticed that Our Monstress is now sounding like "Jerry," the
"alien" from Michael Crichton's _Sphere_ (the style comes through much
better in the book than in the movie)?
------------------------------
Date: Wed, 12 Jul 2000 19:43:27 -0500
From: Nnickee <nnickee@nnickee.com>
Subject: Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!!
Message-Id: <810D3C98F0FA5942.687CAFD54C173BA7.E14DD2769C9E67AC@lp.airnews.net>
On Wed, 12 Jul 2000 14:28:10 GMT, someone claiming to be
p3rlc0dr@my-deja.com said:
>In article <x7aefoko3a.fsf@home.sysarch.com>,
> Uri Guttman <uri@sysarch.com> wrote:
>> finally, your nickname is kewltawk and foolish. you are not a
>>perlcoder and shouldnt claim it no matter how you encode it.
>How do you know I dont know how to write Perl program? QUIT BEING
>MEAN. YOUR STALKING ME!
LOL
Oh my gawd, thank you, "perlcoder". I haven't laughed this hard in I
don't know how long. I'm actually glad now that I didn't plonk you.
You have a most amusing concept of "stalking" (although not an
original one, it's still most amusing :)
Nnickee
------------------------------
Date: Wed, 12 Jul 2000 22:18:11 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: ATTENTION PERL MEATHEADS!!!!!!!!!!!!!!!!!!!
Message-Id: <smprl3f6nd6182@corp.supernews.com>
Godzilla! (godzilla@stomp.stomp.tokyo) wrote:
: Craig Berry wrote:
: > We like to keep this Perl cocktail party pleasant. Causing a
: > scene to drive away those who are problematic is better than
: > allowing them to become a continuing irritation.
:
: Well golly gosh gee, aren't you and your friends just the
: pompous self-righteous elitist kings and queens of this
: Mule Manure Mountain.
Damn straight we are. We climbed the thing, and we's gonna *rule* it now
that we're up here.
: * brays like an ornery Missouri Mule *
You have no idea how much it turns me on when you do that!
:)
--
| Craig Berry - http://www.cinenet.net/users/cberry/home.html
--*-- "Beauty and strength, leaping laughter and delicious
| languor, force and fire, are of us." - Liber AL II:20
------------------------------
Date: Wed, 12 Jul 2000 15:14:57 -0700
From: blue_haulic <fattahipourNOfaSPAM@usa.net.invalid>
Subject: Beginner with simple question on searching
Message-Id: <201d8cc4.e71f716b@usw-ex0108-061.remarq.com>
I have a Perl/CGI program that essentially searches certain
emails by subject line and returns the subject line to an
html page. My question is that the subject line is never
constant. That is, the beginning of the subject line is the
same, (i.e., News Story) but the other part of the subject
line could be anything (on Zebras). How do I use a regular
expression such as, if($temp =~/subject line/) {}, to search
for all text starting with News Story and ending in
anything. Is there a *.* designation or something to that
effect that would allow me to simply search by the beginning
of a text (i.e., if ($temp +~ /News Story*.*/). If not, is
there another method to my maddness...lol. Thanks for your
help.
* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping. Smart is Beautiful
------------------------------
Date: Wed, 12 Jul 2000 19:37:40 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Beginner with simple question on searching
Message-Id: <slrn8mq0a4.8e8.tadmc@magna.metronet.com>
On Wed, 12 Jul 2000 15:14:57 -0700, blue_haulic <fattahipourNOfaSPAM@usa.net.invalid> wrote:
>to search
>for all text starting with News Story and ending in
>anything.
Which can then be factored to: starting with "News Story".
if ( /^News Story/ ) {
print "'$_' starts with News Story\n";
}
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 12 Jul 2000 22:12:20 GMT
From: bmenon@my-deja.com
Subject: binary to decimal conversion
Message-Id: <8kiqft$7lh$1@nnrp1.deja.com>
Hi,
Does anybody know of a perl built-in function or other means
to convert a binary number to decimal in perl.
Thanks,
Beena
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 12 Jul 2000 15:48:12 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: binary to decimal conversion
Message-Id: <MPG.13d6958aad68673f98abc5@nntp.hpl.hp.com>
In article <8kiqft$7lh$1@nnrp1.deja.com> on Wed, 12 Jul 2000 22:12:20
GMT, bmenon@my-deja.com <bmenon@my-deja.com> says...
> Hi,
> Does anybody know of a perl built-in function or other means
> to convert a binary number to decimal in perl.
Guessing slightly that by 'binary' you mean a number stored as a string
of characters (bytes) and by 'decimal' you mean a number that Perl can
use for internal calculations or print directly as a decimal integer,
then the function you need is unpack(). Much of it is documented under
pack().
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 12 Jul 2000 17:52:09 -0700
From: "Jürgen Exner" <juex@deja.com>
Subject: Re: binary to decimal conversion
Message-Id: <396d12b9$1@news.microsoft.com>
<bmenon@my-deja.com> wrote in message news:8kiqft$7lh$1@nnrp1.deja.com...
> Does anybody know of a perl built-in function or other means
> to convert a binary number to decimal in perl.
Well, for octal, decimal, and hexadecimal you could use the standard printf.
But for binary? I couldn't find anything on CPAN.
But OTOH this is an excercise for the third week of an introduction to
programming class.
jue
------------------------------
Date: 12 Jul 2000 22:05:14 GMT
From: Steffen Beyer <sb@muccpu1.muc.sdm.de>
Subject: Re: Bit shifting...should be exponentiation
Message-Id: <8kiq2q$f8e$1@solti3.sdm.de>
In article <u7hpms4pedoqcnug4v68jfhd4vqb86j9oq@4ax.com>, Bart Lateur <bart.lateur@skynet.be> wrote:
>> (a mod p) * (b mod p) == (a * b) mod p
> Wrong. Take a=b=16, and p=256, for example.
That's exactly why I said p must be a special number,
and probably best prime. 256 is not prime. Nor is 255,
BTW. (But 257 is prime and would do.)
But you're right insofar as this should probably read
[ (a mod p) * (b mod p) ] mod p == (a * b) mod p
instead. :-)
I can't actually remember too well what the exact formula
was, but I think you'll get the idea. ;-)
Yours,
--
Steffen Beyer <sb@engelschall.com>
http://www.engelschall.com/u/sb/whoami/ (Who am I)
http://www.engelschall.com/u/sb/gallery/ (Fotos Brasil, USA, ...)
http://www.engelschall.com/u/sb/download/ (Free Perl and C Software)
------------------------------
Date: Wed, 12 Jul 2000 19:10:18 -0500
From: S P Arif Sahari Wibowo <arifsaha@yahoo.com>
Subject: calling Java methods / classes
Message-Id: <Pine.LNX.4.21.0007121904520.15758-100000@ninitowo.civil.columbia.edu>
Hi!
I am looking to get a perl script using some Java classes and calling
their methods. As far as I know, there is two way to do it so far: using
JPL modules or Java.pm module.
Using JPL will require me to recompile perl - since its dynamic library
requirement, and that may cause perl run slower. Am I right?
Java.pm is nowhere in CPAN. Where is it? Is it work at all?
Any suggestion?
TIA!
--
S P Arif Sahari Wibowo
_____ _____ _____ _____
/____ /____/ /____/ /____ arifsaha@yahoo.com
_____/ / / / _____/ http://www.arifsaha.com/
------------------------------
Date: 12 Jul 2000 23:39:54 GMT
From: bfisher244@aol.com (BFisher244)
Subject: command line input
Message-Id: <20000712193954.05031.00000595@ng-cg1.aol.com>
i am implementing a function and am trying to allow flags.
How can I signal that there is a flag for all input?
ex: SomeFunction File1 File2........ -a -b...
or no flag SomeFunction File1 File2........
I have already implemented the entire function, but i cannot figure out how to
allow for use of flags.
Any help is appreciated.
------------------------------
Date: Wed, 12 Jul 2000 23:59:07 GMT
From: nvp@spamnothanks.speakeasy.org (NP)
Subject: Re: command line input
Message-Id: <fD7b5.304574$MB.5131781@news6.giganews.com>
On 12 Jul 2000 23:39:54 GMT, BFisher244 <bfisher244@aol.com> wrote:
: i am implementing a function and am trying to allow flags.
: How can I signal that there is a flag for all input?
Why not use the Getopt modules: Getopt::Std or Getopt::Long?
--
Nate
------------------------------
Date: Wed, 12 Jul 2000 23:07:34 GMT
From: "Peter B. Ensch" <peterbe@home.com>
Subject: Re: Error from unsupported lookbehind
Message-Id: <396CF7FE.755D986A@home.com>
Drew Simonis wrote:
>
> Peter Ensch wrote:
> >
> > I want to use the positive lookbehind construct
> > (?<=PATTERN) as in:
>
> The what?!?!?
>
> Is this new in 5.6?
No. It's supported on my home system (perl 5.005_03) but
not at work (perl 5.005).
See perldoc perlre or, if your perl doesn't support
it, http://www.perl.com/pub/doc/manual/html/pod/perlre.html
Peter
--
Peter B. Ensch
peterbe@home.com
pensch@dal.asp.ti.com
Linux ~ Where do you want to go tomorrow?
------------------------------
Date: Wed, 12 Jul 2000 22:34:09 GMT
From: Daniel Pfeiffer <occitan@esperanto.org>
Subject: Getopt::Long gripes
Message-Id: <8kirp0$8e7$1@nnrp1.deja.com>
Even though Getopt::Long pretends to have GNU extensions, it works in a
very unGNUish way. When they're converted to long options, GNU utils
will adhere to this scheme
-s, --short
-l, --long
where -sl means both options grouped the traditional way. With
experimenting I've found, that the following conglomerate of options is
necessary to give this normal behaviour:
use Getopt::Long;
Getopt::Long::config qw( bundling no_getopt_compat permute );
This still doesn't allow optional string parameters, although it
pretends to. When an option is advertised as
-o, --option=[arg]
I can normally have -o or --option or -oarg or --option=arg, but not
-o arg or --option arg. Yet Getopt::Long will just as happily eat up
the next parameter unless it happens to be an option, making the :s
specifier counterintuitive and useless, since that parameter might be a
file-name. Who wants, and will indeed remember, to use the --
separator.
--
Bring text-docs to life! Erwecke Textdokumente zum Leben!
http://beam.to/iPerl/
Vivigu tekstodokumentojn!
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 12 Jul 2000 23:54:38 GMT
From: richardstands@my-deja.com
Subject: Help, no cgi push! what else is there?
Message-Id: <8kj0fp$bn7$1@nnrp1.deja.com>
As Internet Explorer does not support server "push", ActiveState's CGI
module's push features are not terribly useful(actually I haven't been
able to make it work for Netscape either on WinNT/Apache).
What I need to do is have one CGI script call return a page that will
refresh itself to show the progressive output of another process(that
it spawns) that takes up to an hour to finish. If I do it the typical
way(and don't spawn another process) the browser will timeout. I can't
do server "push" as I can't know if the user will be using Netscape
(assuming I could even get it to work). I was thinking I could use
backticks or ActiveState's Win32::Process module but after tinkering
for several hours I still cannot find any way to divorce the child
process from the parent so the latter can return the "refresh" page.
Any help with this would be most helpful.
-Rich
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 13 Jul 2000 00:54:45 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: if...elsif...else question
Message-Id: <MPG.13d7b09fb8912c0298968b@news>
Zak McGregor wrote ..
>Hi all
>
>From the perlsyn manpage:
>
>" or even, horrors,
>
> if (/^abc/)
> { $abc = 1 }
> elsif (/^def/)
> { $def = 1 }
> elsif (/^xyz/)
> { $xyz = 1 }
> else
> { $nothing = 1 } "
>
>Is this style of doing switch-like things what scored it the 'horrors'
>tag or is it something else? If that block of code was indented better
>it would lokk fine, IMHO. Perhaps it is less efficient?
it's just visually messy .. and it isn't as clearly switchy as the other
switches (because if/elsif/else clauses can do more than just switch
between various options for the one operand)
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: 12 Jul 2000 21:56:29 GMT
From: Prakash Kailasa <prakash@seminole.gate.net>
Subject: Re: Looping(loop operator?)
Message-Id: <8kipid$1ko2$1@news.gate.net>
Drew Simonis <care227@attglobal.net> wrote:
: JohnCasey wrote:
: >
: > Problem is in the below program , how do i get back to the While loop
: > from the innermost if loop (based on its result) ??
: > *****
: > While (<FILEHANDLE>)
: > {
: > if (/ABCD/)
: > {
: > if ( ! /ZABCD/ )
: > {
: > $value = xyz (based on regex on the above pattern);
: > if ( $value == somecondition)
: > {
: > *** exit and go back to the While loop ***?????? how???
: > }
: > }
: >
: > statements;
: > statements;
: > }
: > }
: Check out the last function. Like: last if $value == somecondition;
: Note that this will break you out of that nested if(). If you want to
: break all the way back, I'd suggest labeling the block, and specifying
: the label in the last condition.
'last' will not break out of the 'if' statement. If 'last' were used in
the above while loop, it would break out of the while loop.
If you want to go back to beginning of the loop, use 'next' instead.
[..useful advice about checking out the FAQs deleted..]
/prakash
------------------------------
Date: Wed, 12 Jul 2000 17:12:09 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Looping(loop operator?)
Message-Id: <slrn8mpnp9.88v.tadmc@magna.metronet.com>
On 12 Jul 2000 12:36:59 -0700, JohnCasey <JohnCasey_member@newsguy.com> wrote:
>
>Problem is in the below program , how do i get back to the While loop
>from the innermost if loop (based on its result) ??
You cannot go back to the While loop (because it won't even compile).
You can get back to a while loop though:
perldoc -f next
>1) I stuck in a "loop" command after the if ($value == somecondition)
What is a "loop command"?
> and it seems to work fine!! . But, is there anything like
> a "loop" command in perl at all!!!?
I don't know.
What is a "loop command"?
>the manuals point to next,
What's wrong with next?
>If there is a better way to do it
There is not.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 13 Jul 2000 00:51:25 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: matching a block of text through RE.
Message-Id: <MPG.13d7afdb4e02b56198968a@news>
markahlstrom@excite.com wrote ..
>I'm having trouble matching a block of text and I was wondering if
>anyone has any ideas. I'm using
> /bla/ ... /bla bla/
>to grab several lines. The problem is that's it's too greedy. It will
>grab the last /bla bla/ when I want it to grab and stop at the first
>/bla bla/.
>
>Any suggetions would be greatly appreciated.
read the documentation more closely .. there's nothing magical about
'...' .. it just evaluates the two operands
if your first operand returns true then '...' returns true .. if /bla/
returns true too much then tighten the regex down .. or set a flag
within the if statement so that it can only do it once
if you can't get it happening then you'll probably need to show some
code .. some sample data for which the problem occurs .. and what you're
trying
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Wed, 12 Jul 2000 17:05:05 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: metrics
Message-Id: <slrn8mpnc1.88v.tadmc@magna.metronet.com>
On Wed, 12 Jul 2000 19:40:57 +0200, Nadim Khemir <nkh@cpen.com> wrote:
>Can someone point me to some metric scripts ?
Here's one:
-------------------------
#!/usr/bin/perl -w
use strict;
print "enter a number of inches: ";
chomp(my $inches = <STDIN>);
my $cm = sprintf "%.2f", $inches * 2.54;
print "$inches inches is $cm centimeters\n";
-------------------------
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 12 Jul 2000 19:20:24 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: Need Help with array (should be easy!)
Message-Id: <slrn8mq0b1.dun.abigail@alexandra.delanet.com>
Larry Rosler (lr@hpl.hp.com) wrote on MMDVII September MCMXCIII in
<URL:news:MPG.13d6774ba53254ce98abc3@nntp.hpl.hp.com>:
}} [Removed alt.perl.]
}}
}} In article <8kij1b$6b7$5@216.155.32.201> on 12 Jul 2000 20:04:59 GMT,
}} The WebDragon <nospam@nospam.com> says...
}}
}} ...
}}
}} > when you have bosses who say "here's a couple gigabytes of log files
}} > from our web servers. How many different IP addresses are in there?".
}} > On Unix, that question could be answered with this:
}} >
}} > cat *.log | sed 's/ .*//' | sort | uniq | wc -l
}}
}} Two processes too many.
}}
}} sed 's/ .*//' *.log | sort -u | wc -l
}}
}} And now we return you to your regularly scheduled Perl program.
Still two processes too many.
awk '!foo [$1] {foo [$1] = 1; count ++} END {print count}' *.log
Abigail
--
sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))
------------------------------
Date: Wed, 12 Jul 2000 16:19:03 -0700
From: Nickolay <kolya3@rocketmail.com>
Subject: parsing CSV file
Message-Id: <396CFCE7.E3EC944F@rocketmail.com>
Hello all,
I am trying to parse a CSV file on a line by line basis.
In otherwords I want to parse a line, where each field is separated with
a
comma. I want to store all these fields in an array.
Unfortunatelly splitting the line simply by commas does not work
since some of the field values themselves contain commas.
I am new to Perl so please bear with me.
Does anyone have a good reg expression that they've already come up with
for this sort of parsing?
Thanks for your time.
-N.
------------------------------
Date: Thu, 13 Jul 2000 00:01:00 GMT
From: nvp@spamnothanks.speakeasy.org (NP)
Subject: Re: parsing CSV file
Message-Id: <0F7b5.304576$MB.5131781@news6.giganews.com>
On Wed, 12 Jul 2000 16:19:03 -0700, Nickolay <kolya3@rocketmail.com> wrote:
:
: I am trying to parse a CSV file on a line by line basis.
: In otherwords I want to parse a line, where each field is separated with
: a
: comma. I want to store all these fields in an array.
You might take a look at DBD::CSV... that's available on CPAN. I
believe that there's also a Text::CSV module.
--
Nate II
------------------------------
Date: Thu, 13 Jul 2000 01:00:46 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: Perl-Access
Message-Id: <MPG.13d7b209b10330ae98968c@news>
Gary Cohen wrote ..
>I am trying to use a MS-Access database for a project I am doing in
>university along with perl.
>
>I am using OLE and everything works great when I test it offline. However,
>when I am trying to put it on my server, it does not want to use the file
>that it used offline.
>
>The one difference is that on my local machine, when testing, I used an ODBC
>DSN called "Cobro" and used the DSN=Cobro in my connection string.
>
>Online, i am trying to do DSN=d:/webpath/...
>The physical location of the file.
>
>Does anyone know a possible error in the following code?
>
>#vallogin.pl : Used to validate the login
>
>use CGI qw(:standard);
>use OLE;
>
>$conn = CreateObject OLE "ADODB.Connection";
>$rs=CreateObject OLE "ADODB.Recordset";
>$rsProd = CreateObject OLE "ADODB.Recordset";
>$rsUpdate= CreateObject OLE "ADODB.Recordset";
>$conn->Open("Provider=Microsoft.Jet.OLEDB.3.51; DSN=d:\webserver\....;
>UID=;PWD=");
>$sql = "SELECT * FROM Members";
>$rs = $conn->Execute($sql);
>
>I removed the actual DSN as I know the path is okay, have done it before
>using ASP.
the backslash character '\' has special meaning in double-quoted strings
.. read more about it in the documentation
perldoc perlop
best bet here is to use a single quoted string .. assuming that you
don't require any interpolation (those '....'s are a little ambiguous ;)
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Wed, 12 Jul 2000 19:43:28 -0500
From: Nnickee <nnickee@nnickee.com>
Subject: Re: Perl... the split function
Message-Id: <42B72383A4507D86.9BD6FEB5C6F8FA28.0D0704C2788B09E5@lp.airnews.net>
On Wed, 12 Jul 2000 15:18:52 +0100, someone claiming to be Antony
<mcnultya@nortelnetworks.com> said:
>Hi there,
Howdy :)
>Wonder if someone can help me with this little problem...
>If the PATTERN contains parentheses, additional array elements are
>created from each matching substring in the delimiter.
> split(/([,-])/, "1-10,20", 3);
>produces the list value
> (1, '-', 10, ',', 20)
right
>My problem is... how do you set the delimiters to be a 'space' and a
>'comma' ?
You don't need parentheses. In fact, you don't *want* parentheses in
this case, if you've come close to stating what results you're
actually wanting. Your pattern consists of a space and a comma. But
what you're splitting doesn't contain a space followed by a comma, so
I'm guessing that you mean a space *or* a comma, yes?
Try these on for size:
$line = '1-10,20'; # no spaces, so..
@list = split (/ ,/, $line); # split on space followed by a comma
print "@list\n"; # since there wasn't a space in $line...
@list2 = split (/,/, $line); # using same $line, split on just a comma
print "@list2\n";
$line2 = '1-10 20,45'; # has a space and a comma, but not together
@list3 = split (/[ ,]/, $line2); # split on a space OR a comma
print "@list3\n";
Nnickee
------------------------------
Date: 12 Jul 2000 20:26:09 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: PRINTing " "" "
Message-Id: <slrn8mq469.dun.abigail@alexandra.delanet.com>
deno (jdNOjdSPAM@syncon.ie.invalid) wrote on MMDVII September MCMXCIII in
<URL:news:1365619e.b93325a7@usw-ex0105-036.remarq.com>:
==
== Does anyone know how to make PRINT print an embedded " symbol?
== I have lines which contain " which must be printed out.
==
== EG
==
== print "$company "some_text" more text" ; and so on.
{local $, = chr hex 22;
print "$company ", "some_text", " more text";
}
HTH. HAND.
Abigail
--
map{${+chr}=chr}map{$_=>$_^ord$"}$=+$]..3*$=/2;
print "$J$u$s$t $a$n$o$t$h$e$r $P$e$r$l $H$a$c$k$e$r\n";
------------------------------
Date: Thu, 13 Jul 2000 00:39:23 GMT
From: "langtind" <arild@langtind.no>
Subject: Problems with reading and printing file!
Message-Id: <%c8b5.2679$Dxe.185835520@news.telia.no>
Can someone tell me way this code would not print to my HTML-page, but the
last (print "HEI\n";) line does!
The test.txt is a text-file with some lines with text.
I want the script to read the file and print it into my web-page.
If I make a print "something\n"; it gets into the web-page, but not the fil!
open(FILE, "test.txt");
while ($line = <FILE>)
{
print "$line";
}
close(FILE);
print "HEI\n";
Trond Aage
------------------------------
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 3644
**************************************