[7572] in Perl-Users-Digest
Perl-Users Digest, Issue: 1198 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 20 03:07:19 1997
Date: Mon, 20 Oct 97 00:00:44 -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 Mon, 20 Oct 1997 Volume: 8 Number: 1198
Today's topics:
Re: @ + @ = % but how? <bugaj@bell-labs.com>
Re: @ + @ = % but how? <bugaj@bell-labs.com>
Re: @ + @ = % but how? <bugaj@bell-labs.com>
Re: @ + @ = % but how? (Jahwan Kim)
Re: Best way to comma seperate a number? (Eric)
Re: Cancelled posts in comp.lang.perl.misc <jeremy@exit109.com>
Re: Cancelled posts in comp.lang.perl.misc (Martien Verbruggen)
comma delimited output <melton@diagdata.com>
Re: comma delimited output <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
Re: comma delimited output (Martien Verbruggen)
Re: comma delimited output (Martien Verbruggen)
Re: comma delimited output <ajohnson@gpu.srv.ualberta.ca>
DB_File binaries for Win32 (was Re: Can I use DBM in wi (Gurusamy Sarathy)
Re: exp1 ? exp2 : exp 3 -- whats wrong? (Martien Verbruggen)
Fastest Compare On Array Elements <bugaj@bell-labs.com>
fill out web form ? (steven)
Re: fill out web form ? (Tad McClellan)
Re: Help: redirected STDOUT lost (buffer overflow?) <romchr@ibm.net>
Re: Help: sybperl 2.08 with RedHat 4.2 <mpersico@erols.com>
Input from plain text file (Darren Ward)
Re: newbie: counting patterns <shiloh@shell9.ba.best.com>
Re: Perl Info! <shiloh@shell9.ba.best.com>
Re: Quest for knowlege part one - Windows question. <afrds2@microserve.net>
Re: Replacing anything not matching with s/? (Nem W Schlecht)
Re: Save As... Name on MS Word downloads (Martien Verbruggen)
Re: SCO Unix (Danny Aldham)
setuid not changing uid (Scott Smith)
Re: statics or const in perl ? <71022.3700@CompuServe.COM>
Syntax for cookies <tborn@msn.com>
text wrap (Mike Rambour)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 20 Oct 1997 01:41:59 -0400
From: Stephan Vladimir Bugaj <bugaj@bell-labs.com>
To: mailus@web-uk.com
Subject: Re: @ + @ = % but how?
Message-Id: <344AEF27.EEED961E@bell-labs.com>
Richard Butcher wrote:
> I have an array:
> @startwith = ("a","b","c","d","e","f","g","h")
>
> How do I insert the first eight fields into a hash that looks like
> %result = "a","0","b","0","c","1","d","0","e","0","f","1","g","0","h","0")
> and then pick up the two other fields as $nine and $ten
>
> I know I can split each line into an array
> @fields = split(/;/,$line);
> and, if necessary, limit it to eight items
> but I don't know how to combine and then pick up the two leftovers.
>
I'd do it something like this (there may be some cool
shortcuts for doing this which I am unaware of...):
# $line = the ; delimited line you mention
@startwith = ("a","b","c","d","e","f","g","h");
chomp($line); #if you don't want the probable \n at the end of $line
#to wind up in $ten
@fields = split(/;/,$line);
$ten = pop(@fields);
$nine = pop(@fields);
$i = 0;
foreach $foo (@startwith)
{
$result{$foo} = $fields[$i];
$i++;
}
--
"Do computers think?"
------------------------------------------------------------------------
Stephan Vladimir Bugaj bugaj@bell-labs.com
Member of Technical Staff (908) 949-3875
Multimedia Communication Research Dept. Rm. 4F-601, Holmdel
Bell Labs of Lucent Technologies www.multimedia.bell-labs.com
PGP Key available from www.pgp.net/wwwkeys.html or your local keyserver.
Non-Lucent personal website located at www.cthulhu-dynamics.com/stephan.
------------------------------------------------------------------------
STANDARD DISCLAIMER: My opinions are NOT necessarily those of LUCENT.
------------------------------------------------------------------------
"Do submarines swim?" - E.W. Dijkstra
------------------------------
Date: Mon, 20 Oct 1997 01:42:17 -0400
From: Stephan Vladimir Bugaj <bugaj@bell-labs.com>
To: mailus@web-uk.com
Subject: Re: @ + @ = % but how?
Message-Id: <344AEF38.455E5634@bell-labs.com>
Richard Butcher wrote:
> I have an array:
> @startwith = ("a","b","c","d","e","f","g","h")
>
> How do I insert the first eight fields into a hash that looks like
> %result = "a","0","b","0","c","1","d","0","e","0","f","1","g","0","h","0")
> and then pick up the two other fields as $nine and $ten
>
> I know I can split each line into an array
> @fields = split(/;/,$line);
> and, if necessary, limit it to eight items
> but I don't know how to combine and then pick up the two leftovers.
>
I'd do it something like this (there may be some cool
shortcuts for doing this which I am unaware of...):
# $line = the ; delimited line you mention
@startwith = ("a","b","c","d","e","f","g","h");
chomp($line); #if you don't want the probable \n at the end of $line
#to wind up in $ten
@fields = split(/;/,$line);
$ten = pop(@fields);
$nine = pop(@fields);
$i = 0;
foreach $foo (@startwith)
{
$result{$foo} = $fields[$i];
$i++;
}
--
"Do computers think?"
------------------------------------------------------------------------
Stephan Vladimir Bugaj bugaj@bell-labs.com
Member of Technical Staff (908) 949-3875
Multimedia Communication Research Dept. Rm. 4F-601, Holmdel
Bell Labs of Lucent Technologies www.multimedia.bell-labs.com
PGP Key available from www.pgp.net/wwwkeys.html or your local keyserver.
Non-Lucent personal website located at www.cthulhu-dynamics.com/stephan.
------------------------------------------------------------------------
STANDARD DISCLAIMER: My opinions are NOT necessarily those of LUCENT.
------------------------------------------------------------------------
"Do submarines swim?" - E.W. Dijkstra
------------------------------
Date: Mon, 20 Oct 1997 01:41:51 -0400
From: Stephan Vladimir Bugaj <bugaj@bell-labs.com>
To: mailus@web-uk.com
Subject: Re: @ + @ = % but how?
Message-Id: <344AEF1E.32B09BD@bell-labs.com>
Richard Butcher wrote:
> I have an array:
> @startwith = ("a","b","c","d","e","f","g","h")
>
> How do I insert the first eight fields into a hash that looks like
> %result = "a","0","b","0","c","1","d","0","e","0","f","1","g","0","h","0")
> and then pick up the two other fields as $nine and $ten
>
> I know I can split each line into an array
> @fields = split(/;/,$line);
> and, if necessary, limit it to eight items
> but I don't know how to combine and then pick up the two leftovers.
>
I'd do it something like this (there may be some cool
shortcuts for doing this which I am unaware of...):
# $line = the ; delimited line you mention
@startwith = ("a","b","c","d","e","f","g","h");
chomp($line); #if you don't want the probable \n at the end of $line
#to wind up in $ten
@fields = split(/;/,$line);
$ten = pop(@fields);
$nine = pop(@fields);
$i = 0;
foreach $foo (@startwith)
{
$result{$foo} = $fields[$i];
$i++;
}
--
"Do computers think?"
------------------------------------------------------------------------
Stephan Vladimir Bugaj bugaj@bell-labs.com
Member of Technical Staff (908) 949-3875
Multimedia Communication Research Dept. Rm. 4F-601, Holmdel
Bell Labs of Lucent Technologies www.multimedia.bell-labs.com
PGP Key available from www.pgp.net/wwwkeys.html or your local keyserver.
Non-Lucent personal website located at www.cthulhu-dynamics.com/stephan.
------------------------------------------------------------------------
STANDARD DISCLAIMER: My opinions are NOT necessarily those of LUCENT.
------------------------------------------------------------------------
"Do submarines swim?" - E.W. Dijkstra
------------------------------
Date: 20 Oct 1997 02:49:49 GMT
From: jahwan@supernova.math.lsa.umich.edu (Jahwan Kim)
Subject: Re: @ + @ = % but how?
Message-Id: <slrn64lhmc.bgl.jahwan@supernova.math.lsa.umich.edu>
On 19 Oct 1997 23:15:03 GMT, Daniel S. Lewart <d-lewart@uiuc.edu> wrote:
> "Richard Butcher" <mailus@web-uk.com> writes:
>
> > ...
> > How do I insert the first eight fields into a hash that looks like
> > %result = "a","0","b","0","c","1","d","0","e","0","f","1","g","0","h","0")
> > and then pick up the two other fields as $nine and $ten
> > ...
>
> One way (of many) is to splice and slice:
> @startwith = qw(a b c d e f g h);
> $line = '0;0;1;0;0;1;0;0;jiu;shi';
> @fields = split(/;/, $line);
> ($nine, $ten) = splice(@fields, -2);
> @result{@startwith} = @fields;
>
> Daniel Lewart
> d-lewart@uiuc.edu
(@result{@startwith}, $nine, $ten) = split /;/, $line;
Jahwan
------------------------------
Date: 20 Oct 1997 03:58:20 GMT
From: pojo@gte.net.nospam (Eric)
Subject: Re: Best way to comma seperate a number?
Message-Id: <62ekss$1s1$1@gte2.gte.net>
>
> This one will do it for you:
>
> sub commify {
> local $_ = shift;
> 1 while s/^(-?\d+)(\d{3})/$1,$2/;
> return $_;
> }
>
> $n = 23659019423.2331;
> print "GOT: ", commify($n), "\n";
>
> GOT: 23,659,019,423.2331
>[snip rest of faq answer]
Okay, I found this in the FAQ. Why does it work? More specifically, why does:
1 while s/^(-?\d+)(\d{3})/$1,$2/;
do what it does?? What is that 1 doing in there?
-- Eric
------------------------------
Date: 20 Oct 1997 01:00:20 GMT
From: Jeremy <jeremy@exit109.com>
Subject: Re: Cancelled posts in comp.lang.perl.misc
Message-Id: <62eaf4$bcb$1@news1.exit109.com>
Danny Aldham <danny@lennon.postino.com> wrote:
> I have noticed this afternoon that hundreds of posts to
> this news group are being cancelled. I don't honor cancels
> but I am sure most sites do. Attached is a sample cancel,
> with headers intact.
At least they've stopped putting my address in the headers. :)
See http://www.sputum.com/ucepage.htm for the story.
It's worth noting that a few lines of Perl are keeping all
of these cancels off my news server...
--
Jeremy | jeremy@exit109.com
"Everything you think you know is wrong." --Jack Chalker
------------------------------
Date: 20 Oct 1997 03:13:37 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Cancelled posts in comp.lang.perl.misc
Message-Id: <62ei91$fm2$2@comdyn.comdyn.com.au>
In article <62bnbl$aiv$1@lennon.postino.com>,
danny@lennon.postino.com (Danny Aldham) writes:
> I have noticed this afternoon that hundreds of posts to
> this news group are being cancelled. I don't honor cancels
> but I am sure most sites do. Attached is a sample cancel,
> with headers intact.
> From: rgm@eyrie.org
rgm@eyrie.org is the post-submission gateway for a moderated newsgroup
(rec.games.mecha). it seems that some people got a bit upset with the
moderation of this group, which is why they're cancelling posts all
over usenet at the moment, forging the email address.
You could complain to the people on news.admin.net-abuse.usenet, in
the hope that they will try to find out who is doing it.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | If at first you don't succeed, try
Commercial Dynamics Pty. Ltd. | again. Then quit; there's no use being
NSW, Australia | a damn fool about it.
------------------------------
Date: Sun, 19 Oct 1997 22:10:40 -0400
From: Alan Melton <melton@diagdata.com>
Subject: comma delimited output
Message-Id: <344ABDA0.328A89CF@diagdata.com>
I input file with 20 individual lines into an array.
I write certain lines to another file, but I want these
strings from the "certain" lines to be output
on one line, separated by commas.
Suggestions?
A Melton
------------------------------
Date: Sun, 19 Oct 1997 20:28:48 -0700
From: "Creede Lambard" <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
Subject: Re: comma delimited output
Message-Id: <62ej5h$bgh@mtinsc04.worldnet.att.net>
I'm not 100% sure what you're trying to do here. Is it something like this?
First file (read into array)
Line 1
Line 2
Line 3
Line 4
Line 5
<EOF>
Second file (the "certain" lines, which are read into @lines and output to
file handle OUTFILE)
Line 1,Line 3,Line 5
If so, it should be relatively easy:
$string = "";
foreach (@lines) { $string .= $_ . ","; }
chop($string);
print OUTFILE $string,"\n";
Chopping at the end is easier than trying to figure out the code to leave
the comma off of the last entry in the string. :D
--- Creede Lambard
Minister of Irregular Expressions
Programming Republic of Perl
Alan Melton wrote in message <344ABDA0.328A89CF@diagdata.com>...
>I input file with 20 individual lines into an array.
>I write certain lines to another file, but I want these
>strings from the "certain" lines to be output
>on one line, separated by commas.
>Suggestions?
>A Melton
------------------------------
Date: 20 Oct 1997 03:42:08 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: comma delimited output
Message-Id: <62ejug$fv5$1@comdyn.comdyn.com.au>
In article <344ABDA0.328A89CF@diagdata.com>,
Alan Melton <melton@diagdata.com> writes:
> I input file with 20 individual lines into an array.
> I write certain lines to another file, but I want these
> strings from the "certain" lines to be output
> on one line, separated by commas.
> Suggestions?
(Assuming your "certain" lines are lines containing the word 'certain')
#!/usr/local/bin/perl5 -w
open(FF, 'file') or die "Cannot open file: $!";
while (defined($line = <FF>))
{
next if ($line !~ /certain/);
chomp($line);
print "$line,";
}
close(FF);
++++
OR
#!/usr/local/bin/perl5 -w
open(FF, 'file') or die "Cannot open file: $!";
my @array = grep(/certain/, <FF>);
close(FF);
foreach (@array) { chomp; }
print join( ",", @array );
+++
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | That's not a lie, it's a terminological
Commercial Dynamics Pty. Ltd. | inexactitude.
NSW, Australia |
------------------------------
Date: 20 Oct 1997 05:53:19 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: comma delimited output
Message-Id: <62erkf$ghk$1@comdyn.comdyn.com.au>
In article <62ej5h$bgh@mtinsc04.worldnet.att.net>,
"Creede Lambard" <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print> writes:
> $string = "";
> foreach (@lines) { $string .= $_ . ","; }
> chop($string);
$string = join(',', @lines);
> Chopping at the end is easier than trying to figure out the code to leave
> the comma off of the last entry in the string. :D
that's what join is for :)
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | In a world without fences, who needs
Commercial Dynamics Pty. Ltd. | Gates?
NSW, Australia |
------------------------------
Date: Mon, 20 Oct 1997 00:42:42 -0600
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: comma delimited output
Message-Id: <344AFD62.2AD1EA12@gpu.srv.ualberta.ca>
Alan Melton wrote:
>
> I input file with 20 individual lines into an array.
> I write certain lines to another file, but I want these
> strings from the "certain" lines to be output
> on one line, separated by commas.
> Suggestions?
well, if the data is in 'data.txt' and you want
to write to 'out.txt' and you only want those lines
containing XXX, then this might do it for you:
perl -e 'print join(",",grep{chomp&&/XXX/}<>),"\n"' data.txt > out.txt
might not be optimal, but you're only talking about 20 lines
of data :-)
regards
andrew
------------------------------
Date: 20 Oct 1997 02:59:36 GMT
From: gsar@engin.umich.edu (Gurusamy Sarathy)
Subject: DB_File binaries for Win32 (was Re: Can I use DBM in windows NT ????)
Message-Id: <62eheo$ib1@srvr1.engin.umich.edu>
[ mailed and posted ]
In article <62cuuh$ngd@news2.jaring.my>, B.S.LEE <bslee@pl.jaring.my> wrote:
>
>Usually, DBM(Database Management) is used under UNIX system. But my
>web server is WindowsNT 4.0. So, can I use DBM to maintain a database
>server under WindowsNT 4.0. I personally don't want to use SQL or MS
>Assess because I just want to maintain a small size of web database.
>If anybody have any good suggestions, please help me.
DB_File-1.54 will build out of the box on win32 with the latest perls.
I have put a binary distribution of DB_File that will work with the
standard port (available on CPAN) here:
http://www-personal.umich.edu/~gsar/DB_File-1.54-win32-bin.zip
If someone will confirm that it works on Windows95, I'll send it
to CPAN. The zipfile doesn't contain MSVCRT.DLL which is needed
by LIBDB.DLL that's in there, so I'd like to know if that's not
available on Win95.
- Sarathy.
gsar@umich.edu
------------------------------
Date: 20 Oct 1997 03:26:41 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: exp1 ? exp2 : exp 3 -- whats wrong?
Message-Id: <62ej1h$fm2$3@comdyn.comdyn.com.au>
In article <3448F6CF.47AFFB8E@shaw.wave.ca>,
Rick Delaney <rick.delaney@shaw.wave.ca> writes:
>> Did I forget any brackets??
>
> Yes. Try:
>
> $flag==1 ? ($color="blue") : ($color="red");
or (increasing order of readability, in my opinion):
$color = $flag == 1 ? 'blue' : 'red';
$color = ( $flag == 1 ? 'blue' : 'red' );
$color = ($flag == 1) ? 'blue' : 'red';
$color = ( ($flag == 1) ? 'blue' : 'red' );
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | A Freudian slip is when you say one
Commercial Dynamics Pty. Ltd. | thing but mean your mother.
NSW, Australia |
------------------------------
Date: Mon, 20 Oct 1997 00:54:36 -0400
From: Stephan Vladimir Bugaj <bugaj@bell-labs.com>
Subject: Fastest Compare On Array Elements
Message-Id: <344AE40B.635F2555@bell-labs.com>
First off, Thanks to those who helped debug the CGI.pm program I posted
about earlier.
Next...
What is the fastest way (computation time, not programmer time) to use
all of
the elements in an array for && and || comparison?
I've come up with
#Logical And
#if ($fnord =~/$bar[0]/ && ... $fnord=~$bar[n])
#
$fnord, $flag=0;
foreach $foo (@bar)
{
if(! $fnord=~/ $foo/) { $flag = 1; }
}
if(!$flag)
{
#do the thing...
}
#Logical Or
#if($fnord=~/$bar[0]/ || ... $fnord=~$bar[n])
#
$fnord, $flag=0;
foreach $foo (@bar)
{
if($fnord=~/$foo/)
{
$flag = 1;
last;
}
}
if($flag)
{
#do the thing
}
...but there must be something faster...
Thanks.
LL+P,
Stephan
--
"Do computers think?"
------------------------------------------------------------------------
Stephan Vladimir Bugaj bugaj@bell-labs.com
Member of Technical Staff (908) 949-3875
Multimedia Communication Research Dept. Rm. 4F-601, Holmdel
Bell Labs of Lucent Technologies www.multimedia.bell-labs.com
PGP Key available from www.pgp.net/wwwkeys.html or your local keyserver.
Non-Lucent personal website located at www.cthulhu-dynamics.com/stephan.
------------------------------------------------------------------------
STANDARD DISCLAIMER: My opinions are NOT necessarily those of LUCENT.
------------------------------------------------------------------------
"Do submarines swim?" - E.W. Dijkstra
------------------------------
Date: 20 Oct 1997 03:18:16 GMT
From: steven@ccat.sas.upenn.edu (steven)
Subject: fill out web form ?
Message-Id: <62eiho$ea9$1@netnews.upenn.edu>
hi,
i would like to write a routine that goes to specific web page and fills
out a web form. do you how i could do this? if the "method" of that form
is "post" (i.e., it includes all the information submitted in the URL of
the web it returns), then this is fairly trivial to do, you can include
the information in the the URL you open. but the problem is that most of
the pages i want to do this for use method=get (i.e., the pages they
return have just standard whatever.cgi or whatever.pl filenames, not
whatever.cgi?name=steven like the post method does). do you know how i
could do this, or somewhere to point me to? i looked in the perl faq,
but i couldn't find anything of this sort. thanks.
steven
------------------------------
Date: Sun, 19 Oct 1997 23:01:55 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: fill out web form ?
Message-Id: <j3le26.b86.ln@localhost>
steven (steven@ccat.sas.upenn.edu) wrote:
: i would like to write a routine that goes to specific web page and fills
: out a web form.
[ snip ]
: i looked in the perl faq,
: but i couldn't find anything of this sort.
Of course not. The perl documentation documents perl, and what you
are trying to find out about is not a feature of perl.
The Common Gateway Interface defines what you are looking for.
So ask in a newsgroup that has at least something to do with
what you are seeking, such as:
comp.infosystems.www.authoring.cgi
Perl != CGI
: thanks.
Uh huh.
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 19 Oct 1997 23:53:57 -0700
From: Chris Romano <romchr@ibm.net>
To: Jason Gloudon <jgloudon@bbn.remove.com>
Subject: Re: Help: redirected STDOUT lost (buffer overflow?)
Message-Id: <344B0005.41C499B3@ibm.net>
Jason Gloudon wrote:
> Chris Romano (romchr@ibm.net) wrote:
> : Hi...
>
> : I'm trying to redirect the output from a "tar -cvf" command to a file:
>
> Not too familiar with AIX, but this will do what you want, with or
> without GNU tar.
>
> system("tar cvf filename ./home ./usr ./apps");
>
> Jason Gloudon
Nope...you misunderstood my problem. I want to tar to a tape but redirect
the
standard output to a file so I can see later what files were backed up.
Unfortunately, the file which I redirect the stdout to only contains the 2nd
half of the standard output
from the tar command. It seems as though the 1st half of the output is
somehow
always lost.
Chris Romano
------------------------------
Date: Sun, 19 Oct 1997 22:26:55 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
To: Jeffrey Yu <jyu@castle.net>
Subject: Re: Help: sybperl 2.08 with RedHat 4.2
Message-Id: <344AC16F.C92E706E@erols.com>
What are the compiler and C library versions?
Jeffrey Yu wrote:
>
> I tried to compile the sybperl 2.08 CTlib in RedHat 4.2, I got
> a lot of "undefined reference to ' ' " errors. I have tried almost
> everything I can think of, but nothing seems to work so far.
> If anyone knows the answer to solve the problem, please
> share it with us, I believe over time there will be more and
> more people look into this tool. And an effective solution
> can save a lot of time. Thanks in advance.
>
> --Jeff
------------------------------
Date: Sat, 18 Oct 1997 06:49:31 GMT
From: dward@pla.net.au (Darren Ward)
Subject: Input from plain text file
Message-Id: <34485ba3.21763426@fullnews.pla.net.au>
Hi,
I need a way to read a variable length string from a file for use as a
variable to another program.
I have worked out the grep executions and cut features I need but not
read() in Perl for variable length strings.
Any help greatly appreciated.
Darren
------------------------------
Date: 20 Oct 1997 06:35:20 GMT
From: <shiloh@shell9.ba.best.com>
Subject: Re: newbie: counting patterns
Message-Id: <62eu38$7mh$2@nntp1.ba.best.com>
Benjamin Holzman <bholzman@mail.earthlink.net> wrote:
: > if the pattern is more complicated than a single character:
: >
: > $count=()=/$pattern/g; #perl5.004 or better only
: > or perhaps
: > $count=@{[/$pattern/g]};
: I can't tell you how much I love this expression :-)
Here's an expression I've always liked
--Joe McCaughan | The blessing of the Lord makes one rich,
shiloh@best.com | And He adds no sorrow with it. Proverbs 10:22
: > or even
: > $count=s/($pattern)/$1/g;
: I wonder if this is less efficient than the previous two...
: >
: > (assuming the line is in $_ ... efficiency concerns left
: > as an excersise :-)
: >
: > regards
: > andrew
------------------------------
Date: 20 Oct 1997 06:23:33 GMT
From: <shiloh@shell9.ba.best.com>
Subject: Re: Perl Info!
Message-Id: <62etd5$7mh$1@nntp1.ba.best.com>
Tammy Lowney <tlowney@gonzaga.edu> wrote:
: I am new to the perl language and would like some information sources on
: where to get started (books, websites...). Any suggestions would be
: appreciated. Thanks!!
I would recommend that you get "Learning Perl" by Randal Schwartz.
--Joe McCaughan | He who heeds the word wisely will find good,
shiloh@best.com | And whoever trusts in the Lord, happy is he. Proverbs 16:20
------------------------------
Date: Sun, 19 Oct 1997 23:14:20 -0400
From: Dave Stephens <afrds2@microserve.net>
Subject: Re: Quest for knowlege part one - Windows question.
Message-Id: <344ACC8C.1100@microserve.net>
1.) Download Netscape Fastrack Server for Windows 95.
2.) Since you probably don't have a static IP and a host name,
go to Networking in the control panel while you're offline,
turn on DNS and enter any fictional address in the host
and domain section, but don't enter any DNS servers. Then enter
any old IP number in as a static IP. (To get one to work with
do this when you're on-line with your ISP START --> RUN -->
"winipcfg" This will give you the IP number your ISP assigned
when you logged on).
3.) Now install the server. What this will do is setup your system
as a stand alone http server. It's kind of a pain in the ass
to have to change the settings each time you log on to your
ISP (change back to dynamic IP assignment, disable DNS, etc.
But it will allow you to test your scripts on your machine.
4.) Oh, well you have to install PERL and turn on CGI as a file
type on the server too. Don't forget to associate the extension
.pl in Windows 95 with perl.exe. And make sure to put "%1"
after the association path. Example: c:\perl\perl5\perl.exe "%1"
5.) Don't bother defining a CGI bin. Just activate CGI as a file
type and add this line to your mime.types file at here:
c:\serverdirectory\httpd-<server>\config\mime.types
type=magnus-internal/shellcgi exts=pl
Then apply changes, restart server, and go.
See netscape help files for help activating perl cgi.
I use this setup to test perl cgi scripts on my home box
before uploading them to the server I administrate. It
works just fine.
Luck.
-- Dave Stephens
Dan Norcott wrote:
>
> Sorry to burden all you regulars with yet another newbie scum squealing for
> information,
> but that's what I am and that's the only way I'll ever stop being a
> squealy-newbie-type thing.
>
> My question is this:
>
> I've got a PC with Win95, and an account with a service provider who allows
> me to upload my own
> scripts. This I have done, and it works lovely, but it isn't perfect.
> Originally, as I wrote my scripts,
> I was writing them on my PC and uploading them before trying them out
> online. As you can imagine,
> this was time consuming and offensive. Finally, I acquired enough common
> sense to download Perl
> for Win32, which works a treat. However, as I am writing scripts for use
> within web pages, I need to
> do more than just be able to run programs from DOS using the 'perl
> filename' command.
> Ideally, I would like to be able to run my scripts from a web page on my
> own hard drive - is there any
> way to do this? My scripts are all invoked by forms on the web, and I
> don't see how I could get something
> similar to work on my PC. If anybody knows any ways to do this, or any
> solution, however strange,
> then I would be eternally grateful if you would email me at
> dagon@dagon.co.uk.
>
> Thanking you in anticipation for your godlike intervention,
> Dan Norcott.
------------------------------
Date: 19 Oct 1997 19:46:51 -0500
From: nem@abattoir.cc.ndsu.nodak.edu (Nem W Schlecht)
Subject: Re: Replacing anything not matching with s/?
Message-Id: <62e9lr$9b2@abattoir.cc.ndsu.nodak.edu>
[courtesy copy e-mailed to author(s)]
In comp.lang.perl.misc, Mattias Lvnnqvist <Mattias.Lonnqvist@-NO-SPAM-.uidesign.se> wrote:
>Bart Lateur wrote:
>
>> >I am trying to replace anything not matching a-z, A-Z, blank/space with
>> >nothing, eg
>> >getting a resulting string with only these chars.
>>
>> tr/a-zA-Z //d;
>
>Thanx, but I wanted the opposite. Eg, on indata 'abc 123 ma1t2t3i4a5s !ab' I
>want
>the outdata 'abc mattias ab' and not '12312345!'. (Which the tr operation
>above gives)
Hmm..
Try one of these:
$input =~ s/[^a-z ]*//oig;
$input =~ tr/a-zA-Z //cd;
--
Nem W Schlecht nem@plains.nodak.edu
NDUS UNIX SysAdmin http://www.nodak.edu/~nem
"Perl did the magic. I just waved the wand."
------------------------------
Date: 20 Oct 1997 02:57:19 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Save As... Name on MS Word downloads
Message-Id: <62ehaf$fm2$1@comdyn.comdyn.com.au>
In article <01bcd9cf$c2220b80$bde08ecf@mark.metro2000.net>,
"Mark" <mark@metro2000.net> writes:
> Can anyone see what I need to do different to make the Save As filename the
> same as the name of the file being downloaded?
This is not a perl question. it is a cgi question. Next time, please
use one of the groups under comp.infosystems.www.*.
An answer to your question:
invoke the cgi with a url like:
http://some_server/cgi-path/script_name/save_as_this.doc
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | In a world without fences, who needs
Commercial Dynamics Pty. Ltd. | Gates?
NSW, Australia |
------------------------------
Date: 19 Oct 1997 19:26:28 -0700
From: danny@lennon.postino.com (Danny Aldham)
Subject: Re: SCO Unix
Message-Id: <62efgk$6p3$1@lennon.postino.com>
Herbert Travis wrote:
>
> I am running SCO Unix Open Server V. I have been unable to find a PERL
> binary that will with this OS. (I don't have a C compiler) Where can I
> get this. Thanks
Check at www.sco.com and look in the Skunk directories, or at
www.celestial.com . Both have it. Or you can look at www.sco.com
for the gcc port, install it and the libraries included with
SCO Openserver , and roll your own perl from source.
--
Danny Aldham SCO Ace , MCSE , JAPH , DAD
I wak'd, she fled, and day brought back my night. jm
------------------------------
Date: 19 Oct 1997 20:16:58 GMT
From: scottsmi@blue.seas.upenn.edu (Scott Smith)
Subject: setuid not changing uid
Message-Id: <SCOTTSMI.97Oct19161658@blue.seas.upenn.edu>
When I try running a setuid perl script, it runs as the user invoking
the script. This happened both with a real script that was denied
permission to do what it should have been trying to do as root and with
this test script
#!/usr/bin/perl
use English; print "$EUID\n";
which printed the user uid instead of root's uid.
------------------------------
Date: Sun, 19 Oct 1997 18:15:20 -0400
From: Mr James <71022.3700@CompuServe.COM>
Subject: Re: statics or const in perl ?
Message-Id: <OWwG#xN38GA.240@nih2naab.prod2.compuserve.com>
The 3 standard ways of enforcing privacy in a modules are:
1) lexical variables - my()
2) anonymous subs
3) closures
The concept that you can't enforce privacy in perl is obsolete.
Send me a detailed e-mail if you want a more specific answer.
--
Mr. James, PP-ASMEL,IA,TW, Internet Consultant, 71022.3700@compuserve.com
------------------------------
Date: 18 Oct 1997 13:54:47 GMT
From: "Thomas Born" <tborn@msn.com>
Subject: Syntax for cookies
Message-Id: <01bcdbcd$49cecec0$3ce737cb@tborn>
Hi there;
can anyone tell me the perl code how to sent a cookie as header using perl
for NT and the IIS.
Thanks
Thomas
------------------------------
Date: Mon, 20 Oct 1997 05:16:59 GMT
From: name@server.com (Mike Rambour)
Subject: text wrap
Message-Id: <344ae17f.262941158@news.west.net>
I am trying to make the text::wrap module work, but I dont have
privs on the server to put the module anywhere but my own cgi
directory. I dont know how to do this, I assume I copy the wrap.pm
into my cgi and in my script somehow tell it to use that module in my
directory.
So how do I do that please ? I think I need to modify the @INC but I
am not sure, and I am not even sure if thats right.
Any help would be greatly appreciated.
mike
p.s. What I am trying to do is take text from a textarea and save it
to a file but I need the output in 70 chars and it comes out as one
big line. From my searching of the web, what I think I need is
text:::wrap.
mikey at inline-tech dot com
(replace at with @ and replace dot with . to reply)
And for you automated email spammers out there, here's the email addresses
of the current board of the Federal Communications Commission:
Chairman Reed Hundt: rhundt@fcc.gov
Commissioner James Quello: jquello@fcc.gov
Commissioner Susan Ness: sness@fcc.gov
Commissioner Rachelle Chong: rchong@fcc.gov
And let's help you send some spam to the USPS, too:
customer@email.usps.gov
------------------------------
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 1198
**************************************