[7552] in Perl-Users-Digest
Perl-Users Digest, Issue: 1178 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 15 06:17:31 1997
Date: Wed, 15 Oct 97 03:00:34 -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 Wed, 15 Oct 1997 Volume: 8 Number: 1178
Today's topics:
Re: Another Perl vs C question (Fritz W Feuerbacher)
ARGV question <ahecker@interport.net>
Re: ARGV question (brian d foy)
Re: Bulk email solution needed that works with Linux, P <anfi@polbox.com>
CGI / Perl / Win95 help ... (T2N2M0)
Re: Counting the individual characters in a string <sbekman@iil.intel.com>
Creating Arrays on the fly <ryanr@poolpros.com>
file manipulation question <sduffy@dreamscape.com>
Re: file manipulation question (brian d foy)
Flock() <ryanr@poolpros.com>
Re: Getting data from external data <gavinb@pastel.co.za>
global variable under "use strict" <hklein@ikp.uni-koeln.de>
Re: goto &NAME on a method? (Brendan O'Dea)
Help on Security Issues <johnk@discover-net.net>
Re: Help on Security Issues (Michael Fuhr)
Re: How can I "use vars" with Perl 5.001? (Dan Sumption)
How to delete a directory fischers@execpc.com
Re: HTTP Connect with PROXY? (Michael Fuhr)
in line editing of a file using perl <daftary@cisco.com>
Re: Multidimensional Arrays <sbekman@iil.intel.com>
Problem with sockets using perl, Solaris 2.5.1 laptop@investools.com
Re: reg exp size limit !? (Ilya Zakharevich)
Re: REGULAR EXPRESSION: Search & Replace <alecto@magnolia.pe.net>
Re: Static variables (brian d foy)
Re: statics or const in perl ? (dave)
Re: statics or const in perl ? (dave)
Re: Trouble installing on Solaris (Neil Briscoe)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 15 Oct 1997 05:54:01 GMT
From: fwf27775@pegasus.cc.ucf.edu (Fritz W Feuerbacher)
Subject: Re: Another Perl vs C question
Message-Id: <621lpp$naj$1@news.cc.ucf.edu>
John Armsby (jaws@atl.mindspring.com) wrote:
: thought (true or false) that Perl compiling would slow things down. I
: also have been afraid that all those Perl compilations by the users
: would put extra pressure on the hard disks. It seems that the C
What would happen is when your perl script gets envoked, the os loads the
perl interpreter into memory then your script and points the interpreter
to the beginning of your script. This is sort of compiling it on the fly.
I doubt if its creating a whole lot of hard drive overhead. When a C
program runs it has to be read off the hard disk to in order to get into
memory. What would be more efficient is if the os would keep the perl
interpreter in memory all the time so it has it ready when a script comes
along. This would only be practical if scripts were being run constantly.
------------------------------
Date: Wed, 15 Oct 1997 01:48:12 -0400
From: Alan <ahecker@interport.net>
Subject: ARGV question
Message-Id: <3444591C.84996519@interport.net>
Folks,
I'm attempting to read some command line args into a program I'm
writing. Now, it's my understanding that what will follow should work,
given a command line that looks like:
someprogram filename1 filename2 filename3.
So, if I do:
$count = 1;
$len = @ARGV;
until ($count == $len) {
open (IN, $ARGV[$count]);
#do some operations here
close (IN);
$count++;
}
Should the open statement work correctly or not? And if not, 1) what
will make it work the way I need it to--namely, opening the args from
the command line, in order--and 2) why doesn't mine work?
Sorry if this is bonehead, dirt simply stuff, but hey, I've been doing
this a whole 2 weeks now! :-)
Thanx ever so,
-Alan Hecker
--
"Never send a Monster to do the work of an Evil Scientist."
------------------------------
Date: Wed, 15 Oct 1997 06:33:35 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: ARGV question
Message-Id: <comdog-1510970633350001@netnews.worldnet.att.net>
In article <3444591C.84996519@interport.net>, Alan <ahecker@interport.net>
wrote:
> I'm attempting to read some command line args into a program I'm
> writing. Now, it's my understanding that what will follow should work,
> given a command line that looks like:
> someprogram filename1 filename2 filename3.
> $count = 1;
> $len = @ARGV;
> until ($count == $len) {
you could simplify your life with foreach:
foreach( @ARGV )
{
if( open FILE, $_)
{
#do your stuff
}
else
{
#print a message to let us know we couldn't open the file
#and move on to the next file
print "Skipping $_: $!\n";
}
}
god luck :)
--
brian d foy <http://computerdog.com>
#!/usr/bin/perl
$_=q|osyrNewkecnaYhe.mlorsePptMskurj|;s;[NY.PM]; ;g;local$\=
qq$\n$;@pm=split//;while($NY=pop @pm){$pm.=$NY;$ny.=pop @pm}
$pm=join'',reverse($ny,$pm);open(NY,'>&STDOUT');print NY $pm
------------------------------
Date: Wed, 15 Oct 1997 09:51:34 +0200
From: Andrzej Filip <anfi@polbox.com>
To: chris@ixlabs.com
Subject: Re: Bulk email solution needed that works with Linux, Perl
Message-Id: <34447606.CACCB3DE@polbox.com>
You may use sendmail started with -bs option or even better connect directly
to apropriate TCP port of mail server.
It should make you able to send many emails during a single sesion.
-------------------------------------------------------------------------
# sendmail -bs
220 ESMTP ; Wed, 15 Oct 1997 09:43:34 +0200
ehlo localhost
250-localhost Hello root@localhost, pleased to meet you
250-8BITMIME
250-SIZE
250-DSN
250-ONEX
250-ETRN
250-XUSR
250 HELP
mail from: anfi@polbox.com
250 anfi@polbox.com... Sender ok
rcpt to: anfi@polbox.com
250 anfi@polbox.coml... Recipient ok
data
354 Enter mail, end with "." on a line by itself
subject: test A
test A
.
250 JAA23525 Message accepted for delivery
mail from: anfi@polbox.com
250 anfi@polbox.com... Sender ok
rcpt to: anfi@polbox.com
250 anfi@polbox.com... Recipient ok
data
354 Enter mail, end with "." on a line by itself
subject: test B
test B
.
250 JAA23566 Message accepted for delivery
quit
221 smaug.impaq.com.pl closing connection
[root@smaug /root]# mailq
------------------------------
Date: Wed, 15 Oct 1997 08:20:19 GMT
From: rexxchen@ms1.hinet.net (T2N2M0)
Subject: CGI / Perl / Win95 help ...
Message-Id: <62221c$h6@netnews.hinet.net>
Please kindly help me .
=========================
My problem is as below :
1. Two PCs are connected through Win95/lan card .
2. One PC loaded with the followig SW :
* web server named Folk Web .
* Perl5 for Win32 in Win95 English version.
3. My Perl5 source code (a.pl) is as below :
#!/cgi-bin/perl
print ("Content-type : text/html \n\n") ;
print ("<html> <head> \n") ;
print ("<title> TEST </title> </head> \n") ;
print ("<body> \n") ;
print (" TEST CGI-PERL 5 \n") ;
print ("</body> </html> \n") ;
4. Then , I opened Folkweb SW at web server pc ,
at another pc , I opened Navigator , then
connected to David . (name of web server)
then , I can see index.htm in David .
5. In index.htm , I setup a link to a.pl .
BUT , when I tested , it did not work .
I guess the problem is in a.pl .
The first line in a.pl is good for Unix plateform .
How is the coding rule in Win95 ???
Please kindly help me . Many thanks in advance .
Please also cc copy to my EM : rexxchen@ms1.hinet.net
======================================================
------------------------------
Date: Wed, 15 Oct 1997 10:25:27 +0200
From: Bekman Stanislav <sbekman@iil.intel.com>
To: Krishna Podury <krishna@lts-csi.com>
Subject: Re: Counting the individual characters in a string
Message-Id: <34447DF7.167E@iil.intel.com>
Krishna Podury wrote:
>
> Hi all!!
>
> The problem I'm trying to solve is something like this...
>
> I get two words for example
>
> $word1 = "HELPUS";
> $word2 = "FLOP";
>
> I would like to compare each letter in $word2 with the $word1 and
> print out the number of occurances of this letter. In the above
> example, the output would be
> F = 0
> L = 1
> O = 0;
> P = 1;
>
> How would I achieve this? What I'm trying to do is extract each
> character in $word2 using substr() and do something like
> $cnt = ($word2 =~ tr/$char//);
>
> But this doesnt seem to work. Your input is highly appreciated,
> Krishna.
Here the dirty code to make it.
$word1 = "HELPUS";
$word2 = "FLOP";
foreach (split //, $word1){
$letters{$_}++;
}
foreach (split //, $word2){
if ($letters{$_}) {
print "$_=$letters{$_}\n";
}
else {
print "$_=0\n";
}
}
Work on optimisations yourself :-)
______________________________________________________________________
Stas Bekman mailto:sbekman@iil.intel.com.il [WebMaster Intel Corp]
Address: Aba Silver 12/29, Haifa, 32694, Israel
Phones: [w] 972-(0)4-865-5188, [h] 972-(0)4-828-2264/3020
Home Page: http://techunix.technion.ac.il/~ofelix
Resource Center http://www.eprotect.com/stas/TULARC (Java,CGI,PC,Linux)
Linux-il Home: http://www.linux.org.il/
------------------------------
Date: Tue, 14 Oct 1997 22:28:47 -0700
From: ryanr <ryanr@poolpros.com>
Subject: Creating Arrays on the fly
Message-Id: <3444548F.E7C2D86F@poolpros.com>
How would I go about creating a 2 dimensional array on the fly?
right now I am creating my arrays, according to the way Tom Christiansen
says in FMTEYEWTK, such as:
@Table = ([1,2,3,4],
[5,6,7,8],
[9,0,1,2]);
This works o.k.. but what I would really like to do is read my values
in from a file
and build the array. I realize that I would have to use push(), but I'm
not sure how I would go about adding to the 2nd dimension..
Ryan
------------------------------
Date: 15 Oct 1997 03:51:19 GMT
From: "Steven Duffy" <sduffy@dreamscape.com>
Subject: file manipulation question
Message-Id: <01bcd915$bfb25f90$340cc6cf@odin>
Hello,
I have been trying to find an easy way to do this for quite a while now. I
am trying to write a Perl script in which a user can change their data in
the password file such as their shell and their real name. This is going
very well except for one thing. I am having a lot of trouble overwriting
the old line in the password file with the new one. Does any one know of
an easy way to do this. The substitution of the old and new line is no
problem and the script works fine when it has to change root's line
(because this is the first line in the file). I run into problems when the
line I want to change is not the first one. Does anyone have any ideas or
suggestions for me?
Any help would be very much appreciated.
Sincerely,
Steven Duffy
sduffy@dreamscape.com
------------------------------
Date: Wed, 15 Oct 1997 06:21:45 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: file manipulation question
Message-Id: <comdog-1510970621450001@netnews.worldnet.att.net>
In article <01bcd915$bfb25f90$340cc6cf@odin>, "Steven Duffy"
<sduffy@dreamscape.com> wrote:
> I am having a lot of trouble overwriting
> the old line in the password file with the new one.
perhaps you missed section 5 of the Perl FAQ which has the answer to:
How do I change one line in a file/
delete a line in a file/
insert a line in the middle of a file/
append to the beginning of a file?
the Perl FAQ is included with the perl distribution as manual pages,
and can also be found online at <URL:http://www.perl.com/>.
if you have specific problems with the mechanics of the solution,
explain how you are trying to implement it and what is going wrong.
good luck :)
--
brian d foy <http://computerdog.com>
#!/usr/bin/perl
$_=q|osyrNewkecnaYhe.mlorsePptMskurj|;s;[NY.PM]; ;g;local$\=
qq$\n$;@pm=split//;while($NY=pop @pm){$pm.=$NY;$ny.=pop @pm}
$pm=join'',reverse($ny,$pm);open(NY,'>&STDOUT');print NY $pm
------------------------------
Date: Tue, 14 Oct 1997 22:23:37 -0700
From: ryanr <ryanr@poolpros.com>
Subject: Flock()
Message-Id: <34445358.571B6A5B@poolpros.com>
Is simply using flock() on a file, enough to keep multiple users from
accessing it?
I've heard otherwise, but can't remember what the reasons were. Anyway,
I have a counter program that opens a file and writes to it to store the
count. It has been working great for the last 17,000 hits, then
suddenly it is at 200. It used to reset itself all the time before I
put in the flock(), and I thought everything was stable until yesterday!
hehe
Ryan
------------------------------
Date: Wed, 15 Oct 1997 10:36:51 +0200
From: "Gavin Brummelkamp" <gavinb@pastel.co.za>
Subject: Re: Getting data from external data
Message-Id: <621uqm$t1m$1@hermes.is.co.za>
Adeel Ahmad wrote in message <3443D2A4.41C67EA6@nortel.ca>...
>Hi,
>
>I need to be able to get a stock quote from an external web site and
>have it scroll across my own homepage. Has anyone had to deal with this
>kind of thing before?
>Thanks for any help.
>
>Adeel.
I don't think it is possible due to the security problem there is.
But if you speek to the company that supply the stock quote.
You can work something out with them.
Tell me how you came right with that, it is rather a unique problem.
gavinb@pastel.com
------------------------------
Date: 15 Oct 1997 11:01:46 +0200
From: Heiko Klein <hklein@ikp.uni-koeln.de>
Subject: global variable under "use strict"
Message-Id: <3phgajiemd.fsf@hydra.ikp.uni-koeln.de>
Hi,
I'm just writing a client with a user interface (TK). The problem is,
that I won't pass the variables for the Socket to every subroutine,
but only to those who really need it.
It looks like:
---------------------
sub socket{
i'm opening my socket
}
get_data_from_socket{
receive...
}
sub graphik {
&get_data_from_socket(without_passing_socket_data);
....
}
&socket;
&graphik;
--------------------------------
How can I tell get_data_from_socket, where to get the socket data,
without having them passed from graphik. And without reconnecting!
Some global variables would do, but I like to use strict.
Thanks in advance
Heiko
------------------------------
Date: 15 Oct 1997 05:07:23 GMT
From: bod@compusol.com.au (Brendan O'Dea)
Subject: Re: goto &NAME on a method?
Message-Id: <621j2b$o8r$1@diablo.compusol.com.au>
In article <620tgk$b96@netline.jpl.nasa.gov>,
Peter Scott <Peter.J.Scott-remove-to-email@jpl.nasa.gov> wrote:
>How do I use the "highly magical" goto &NAME on a method?
>Where you don't know the class nor the method name at compile time?
>Let's say that you have an object $x and a method whose name is in $m.
>You can invoke it from a subroutine with $x->$m(@_); How can I do the
>same with the goto &NAME form of goto so that caller() doesn't see
>the intervening subroutine?
>Note: I can get by without doing this, so this is just a request for
>information; I don't need workarounds. Oh, and FWIW, I'm using 5.004_01.
>TIA.
Methods are just subroutines, so there is nothing stopping you from
calling them as such, including via goto-&. Note however that calling
a method as a sub (class::method $ref) doesn't search the @ISA tree as
through the reference ($ref->method) does.
So for your $x->$m(@_) example, you can do something like:
unshift @_, $x;
goto &{(ref $x) . '::' . $m};
Regards,
--
Brendan O'Dea bod@compusol.com.au
Compusol Pty. Limited (NSW, Australia) +61 2 9809 0133
------------------------------
Date: Wed, 15 Oct 1997 01:58:10 -0500
From: John Timothy Kelly <johnk@discover-net.net>
Subject: Help on Security Issues
Message-Id: <34446982.2A73@discover-net.net>
Hi:
I was wondering if anyone might be able to help me with adding security
coding to a guestbook file I am writing for my web page. I'm a complete
novice at PERL. I would like to make sure my ISP doesn't get zapped with
anything malicious. It's a simple file, resembling the guestbook from
Matt's Scripts Archive, and all it really does is utilize a form to
input name, address, email, and a short comment. For a newbie like me,
getting the a comments-file-log to append from the main file was a major
victory! I'd like to enhance the security of the file, though.
Thanks MUCH in advance.
JK
johnk@discover-net.net
------------------------------
Date: 15 Oct 1997 02:00:15 -0600
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: Help on Security Issues
Message-Id: <621t6f$77s@flatland.dimensional.com>
John Timothy Kelly <johnk@discover-net.net> writes:
> I was wondering if anyone might be able to help me with adding security
> coding to a guestbook file I am writing for my web page. I'm a complete
> novice at PERL. I would like to make sure my ISP doesn't get zapped with
> anything malicious. It's a simple file, resembling the guestbook from
> Matt's Scripts Archive, and all it really does is utilize a form to
> input name, address, email, and a short comment. For a newbie like me,
> getting the a comments-file-log to append from the main file was a major
> victory! I'd like to enhance the security of the file, though.
For Perl security issues, read the perlsec manual page. For CGI issues,
it would be better to ask in comp.infosystems.www.authoring.cgi, but
here are a few pointers:
http://www.genome.wi.mit.edu/WWW/faqs/www-security-faq.html
http://www.go2net.com/people/paulp/cgi-security/
--
Michael Fuhr
http://www.dimensional.com/~mfuhr/
------------------------------
Date: Wed, 15 Oct 1997 08:17:10 GMT
From: dan@gulch.demon.co.uk (Dan Sumption)
Subject: Re: How can I "use vars" with Perl 5.001?
Message-Id: <34447b4d.5072373@news.demon.co.uk>
On Mon, 13 Oct 1997 18:08:13 GMT, aml@world.std.com (Andrew M.
Langmead) wrote:
>dan@gulch.demon.co.uk (Dan Sumption) writes:
>
>>Does anyone know of a good workaround which doesn't require removing
>>every 'use strict' in the program?
>
>1. Find another ISP who won't leave obsolete software (with security
>flaws) like 5.001 around unfixed.
Have done so (setting up own server) but I still need the program to
run on as many ISPs machines as possible, so I'd like to get around
this problem.
>3. See if you can make any of those globals file scoped lexical
>variables. That is, my'd variables outside of any block.
I don't think I can (the main variable I'm declaring this way is @ISA,
also $AUTOLOAD and $VERSION - I presume these doesn't work if the
context is changed)
>4. Use fully qualified variable names. According to the "strict"
>documentation (man page or local ports equivalent), the
>"use strict 'vars'" directive will complain about variables unless
>they are either lexically local variables declared via "my" or are
>fully qualified with their package name. The "use strict 'vars'"
>pragma won't complain about the variable "$main::DEBUG", only
>"$DEBUG".
I presume @ISA in package RealityInput becomes @RealityInput::ISA, and
so on - is this correct?
Dan Sumption
http://www.hardnet.co.uk/dan/
------------------------------
Date: Tue, 14 Oct 1997 22:15:54 -0500
From: fischers@execpc.com
Subject: How to delete a directory
Message-Id: <3444356A.34D46393@execpc.com>
How would I delete an entire directory that has a file inside with one
command?
------------------------------
Date: 15 Oct 1997 01:53:45 -0600
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: HTTP Connect with PROXY?
Message-Id: <621sq9$761@flatland.dimensional.com>
"Byron Formwalt" <formwalt@concentric.net> writes:
> Can someone tell me how to connect to an HTTP server, when there is a fixed
> proxy that has to be used?
Use LWP -- the documentation shows how to set a proxy. LWP is part of
libwww, which you can get from the Comprehensive Perl Archive Network
(CPAN):
http://www.perl.com/CPAN/CPAN.html
--
Michael Fuhr
http://www.dimensional.com/~mfuhr/
------------------------------
Date: Wed, 15 Oct 1997 00:20:53 -0700
From: Kuntal Daftary <daftary@cisco.com>
Subject: in line editing of a file using perl
Message-Id: <34446ED5.6A72@cisco.com>
hi
i know how to usually edit a file inline using perl.
we just use the -i switch. eg:
---
#!/usr/local/bin/perl -pi.bak
s/oldpattern/newpattern/g;
---
but what can i dont know the name of the file
i want to edit before the inline editing begins.
will this work in that case?
#!/usr/local/bin/perl -pi.bak
$file = <STDIN>;
$oldpattern = <STDIN>;
$newpattern = <STDIN>;
# -- want to do inline editing on $file
@ARGV = ($file);
while (@ARGV) {
s/oldpattern/newpattern/g;
}
--
Kuntal M. Daftary Cisco Systems Inc
Ph: 408 527 9789 170 W. Tasman Dr
daftary@cisco.com San Jose CA 95134
------------------------------
Date: Wed, 15 Oct 1997 09:57:23 +0200
From: Bekman Stanislav <sbekman@iil.intel.com>
To: ryanr <ryanr@poolpros.com>
Subject: Re: Multidimensional Arrays
Message-Id: <34447763.41C6@iil.intel.com>
ryanr wrote:
>
> I have a tabel of data that has widths, and lengths.. and then
> corresponding prices for all.
> I'm not really sure how I should go about storing this table. I would
> like to just put it in a standard multidimensional array, but I'm not
> sure I fully understand how to do it in perl.
>
> Thanks... Ryan
MLDBM.pm will do it.
Must read a note in perldoc how to modify and store technique
(you have to make temp copy of first sublevel of MultiD array, make
changes and then copy it back!)
______________________________________________________________________
Stas Bekman mailto:sbekman@iil.intel.com.il [WebMaster Intel Corp]
Address: Aba Silver 12/29, Haifa, 32694, Israel
Phones: [w] 972-(0)4-865-5188, [h] 972-(0)4-828-2264/3020
Home Page: http://techunix.technion.ac.il/~ofelix
Resource Center http://www.eprotect.com/stas/TULARC (Java,CGI,PC,Linux)
Linux-il Home: http://www.linux.org.il/
------------------------------
Date: Wed, 15 Oct 1997 02:37:46 -0600
From: laptop@investools.com
Subject: Problem with sockets using perl, Solaris 2.5.1
Message-Id: <876899451.21435@dejanews.com>
We use a connect() call to open a connection to a
remote http server. When that server is unavailable for some reason, we
sometimes see the connect() hang indefinately. Is there some way to
enforce a short timeout on this connection?
I've set an alarm signal that forces the program to continue if there is
no response, but this seems to leave these sockets open, and use up
system resources.
(using
Sockets.pm
perl v5.002
solaris 2.5.1
)
Thanks
Thor
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 15 Oct 1997 04:34:59 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: reg exp size limit !?
Message-Id: <621h5j$6b1$1@agate.berkeley.edu>
In article <3443A50C.59E2@pcocd2.intel.com>,
Saviz Artang - MPG ~ <sartang@pcocd2.intel.com> wrote:
> ok. Just an update on the size limit.
> What I didn't mention was that I was
> using (.|\n)+ to match all characters.
> And the string that finally matched this
> was very long (~ 32776 chars long ) and it
> failed to match it if it's longer than this.
>
> but when I tried using .+ and the /s operator
> it works find with bigger strings. my problem is
> solved for now but I'm still baffled between
> the difference in handling of (.|\n) and . used
> with /s
There is none with Jumbo RE patch. It moves the boundary of
"complicated" blocks *far* away from where it is now. However, as I
mentioned in a different message, those blocks which *remain*
complicated are implemented via recursion, thus the repeat count is
limited by stack size. To avoid segfaults, the (old) limit of 32k is
not lifted.
Ilya
------------------------------
Date: 15 Oct 1997 06:05:46 GMT
From: alecto <alecto@magnolia.pe.net>
Subject: Re: REGULAR EXPRESSION: Search & Replace
Message-Id: <621mfq$j34$1@nntp.pe.net>
Vinny Carpenter <carpente@execpc.com> wrote:
>Run through a text file. Find all lines that are ALL CAPS and add
>something to them. For example: If it encounters something like this:
>Before:
>ASK NOT WHAT YOUR COUNTRY CAN DO FOR YOU..
>After:
><H3>ASK NOT WHAT YOUR COUNTRY CAN DO FOR YOU ..</H3>
>There will be several other lines in that file that have mixed case that
>should be ignored.
one way is:
#! /usr/bin/perl -pi.bak
$foo = "\<\/H3\>";
unless (/[a-z]/) { chomp ; $_ = $foo.$_.$foo."\n"; }
------------------------------
Date: Wed, 15 Oct 1997 06:23:59 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Static variables
Message-Id: <comdog-1510970623590001@netnews.worldnet.att.net>
In article <34442718.3F54@worldnet.att.net>,
joegottman@nospam.worldnet.att.net wrote:
> Is it possible to declare a static variable inside a Perl
> subroutine?
section 7 of the Perl FAQ contains the answer to:
How do I create a static variable?
the Perl FAQ is included with the perl distribution as manual pages,
and can also be found online at <URL:http://www.perl.com/>.
--
brian d foy <http://computerdog.com>
#!/usr/bin/perl
$_=q|osyrNewkecnaYhe.mlorsePptMskurj|;s;[NY.PM]; ;g;local$\=
qq$\n$;@pm=split//;while($NY=pop @pm){$pm.=$NY;$ny.=pop @pm}
$pm=join'',reverse($ny,$pm);open(NY,'>&STDOUT');print NY $pm
------------------------------
Date: Wed, 15 Oct 1997 02:04:29 GMT
From: over@the.net (dave)
Subject: Re: statics or const in perl ?
Message-Id: <344423b9.770927@news.one.net>
over@the.net (dave) wrote:
>faust@wwa.com (Faust Gertz) wrote:
>
>>On Tue, 14 Oct 1997 20:35:25 GMT, over@the.net (dave) wrote:
>>
>>>I took a look and "use constant" seems to have some gotchas. Why use it over
>>>typeglob references?
>>
>>Please enlighten us. What are the gotchas?
>>
>>Faust Gertz
>>Philosopher at Large
>
>Enter: perldoc constants
>
>
Sorry, thats:
perldoc constant
There are numerous cautions on use of them. I'm just wondering if they provide
enough benefit to warrant the additional complication?
Dave
|
| Please visit me at http://w3.one.net/~dlripber
|
| For reply by email, use:
| dlripber@one.net
|________
------------------------------
Date: Wed, 15 Oct 1997 01:57:12 GMT
From: over@the.net (dave)
Subject: Re: statics or const in perl ?
Message-Id: <34442252.412541@news.one.net>
faust@wwa.com (Faust Gertz) wrote:
>On Tue, 14 Oct 1997 20:35:25 GMT, over@the.net (dave) wrote:
>
>>I took a look and "use constant" seems to have some gotchas. Why use it over
>>typeglob references?
>
>Please enlighten us. What are the gotchas?
>
>Faust Gertz
>Philosopher at Large
Enter: perldoc constants
Dave
|
| Please visit me at http://w3.one.net/~dlripber
|
| For reply by email, use:
| dlripber@one.net
|________
------------------------------
Date: 15 Oct 1997 06:49:31 GMT
From: neilb@zetnet.co.uk (Neil Briscoe)
Subject: Re: Trouble installing on Solaris
Message-Id: <memo.19971015074930.31769A@skep.compulink.co.uk.cix.co.uk>
In article <34441AEE.1E77@cs.virginia.edu>, as6f@cs.virginia.edu (Anish
Singh) wrote:
> HI,
>
> I'm getting the following error when I'm running make while installing
> perl5.004_1
>
> ***************************************************************
> gcc -B/usr/ccs/bin/ -L/usr/local/lib -L/opt/gnu/lib -o miniperl
> miniperlmain.o libperl.a -lsocket -lnsl -ldl -lm -lc -lcrypt
> Undefined first referenced
> symbol in file
> do_aspawn libperl.a(pp_sys.o)
> do_spawn libperl.a(pp_sys.o)
> ld: fatal: Symbol referencing errors. No output written to miniperl
> *** Error code 1
> make: Fatal error: Command failed for target `miniperl'
> ***************************************************************
>
> My OS is solaris 5.5.1. I'm installing it in my home directory.
> What all options should I specify if I want to install
> libww-perl as well ?
>
Anish,
Don't have /usr/local/lib or /opt/gnu/lib in your configuration. Only
have system provided paths. I had this problem too - remove those two
directories and you won't get the problem.
Regards
Neil
------------------------------
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 1178
**************************************