[9319] in Perl-Users-Digest
Perl-Users Digest, Issue: 2914 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 19 16:07:20 1998
Date: Fri, 19 Jun 98 13:00:27 -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 Fri, 19 Jun 1998 Volume: 8 Number: 2914
Today's topics:
Re: 2 questions about lists <alex@kawo2.rwth-aachen.de>
Re: [Q] On WAKING a sleeping process... <rootbeer@teleport.com>
Re: [Q] On WAKING a sleeping process... (Mark-Jason Dominus)
Re: [Q] On WAKING a sleeping process... (Stuart McDow)
Re: Abigail's Line [Was: regex terminator not allowed i <*@qz.to>
Re: Abigail's Line [Was: regex terminator not allowed i (Craig Berry)
Re: Appending one file to another <b-camp@students.uiuc.edu>
Copying an Anonymous Hash (Boyd Nation)
Re: Copying an Anonymous Hash (Sean McAfee)
Re: Copying an Anonymous Hash (Craig Berry)
Re: Copying an Anonymous Hash (Craig Berry)
Re: Efficiency: required reading <dfan@harmonixmusic.com>
Re: first language (Mark Maurer)
Re: Flames.... <rootbeer@teleport.com>
Re: How to scrub Ctl-Z? (Craig Berry)
Re: How to scrub Ctl-Z? <gacarey@domain.com>
Re: Little help on grabbing text <mike@newfangled.com>
Re: ohsir.pl : suggestive perl poem <mike@newfangled.com>
Re: Pod::Text -- Unix only? <rootbeer@teleport.com>
Re: Reference to arrays (Mark-Jason Dominus)
Re: Regular Expression Question <rootbeer@teleport.com>
Re: Running a VT100 perl script in Windows 95 <chris@nemonet.com>
Re: setuid problem <rootbeer@teleport.com>
Soundcard Control via Perl ioctl()? (doug a blaisdell)
Re: the ?PATTERN? match syntax (Ilya Zakharevich)
Re: the ?PATTERN? match syntax <*@qz.to>
Re: unzip using perl <rootbeer@teleport.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 19 Jun 1998 21:52:54 +0200
From: "Alex Farber" <alex@kawo2.rwth-aachen.de>
Subject: Re: 2 questions about lists
Message-Id: <6mefch$3ea$1@nets3.rz.RWTH-Aachen.DE>
Ronald J Kimball PI[ET W SOOB]ENII
<1daujvo.yjo4rf17ewyp2N@bay1-264.quincy.ziplink.net> ...
>I'm sick of people like you, who ask silly questions and complain when
>someone refers them to the answers elsewhere. That's pretty annoying too.
Ronald,
if you know an answer to my silly question, so tell it me
("AFAIK there's no operator to check if a list contains smth.")
or keep silence.
Saying _every_time_ "RTFM! Buy the Camel book! Browse Dejanews!
Try yourself! Why don't you read all threads in this newsgroup?"
does not help, it just annoys. Either i already did it or i have
no time to do it.
>> Mike, i have Llama and Camel books, the Perl
>> FAQ is in my home dir (ok, i missed it this time)
>> and i know how to use Dejanews.
>
>If you have all those resources, then why weren't you able to find the
>answers to your questions?
Maybe:
a) I am not so clever
b) I tried, but still not sure
c) I hope to learn quick a nice trick
d) I don't have enough time to try everything myself and to read
every thread here because i have some more work to do
>Perhaps because you didn't bother trying. As you noted above, you
>didn't even look in the FAQ before asking your questions here.
Anyway i apologize for being to offensive to Michael. Sorry!
Greetings
Alex
--
russkaya literatura v ------ http://www.simplex.ru/lit.html
internete http://www.friends-partners.org/~afarber/lit.html
java preferans ------------ http://www.simplex.ru/pref.html
besplatnye kommercheskie ob'yavleniya http://www.simplex.ru
------------------------------
Date: Fri, 19 Jun 1998 18:57:34 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: [Q] On WAKING a sleeping process...
Message-Id: <Pine.GSO.3.96.980619114752.15366H-100000@user2.teleport.com>
On 19 Jun 1998, Mark-Jason Dominus wrote:
> In article <Pine.GSO.3.96.980619004558.17544V-100000@user2.teleport.com>,
> Tom Phoenix <rootbeer@teleport.com> wrote:
> >Send it a signal; see the perlfunc and perlipc manpages. Hope this helps!
>
> Well, it doesn't help me, and I'm supposed to know what is going on.
> So perhaps you could elaborate on this a little. Does it work to send
> a sleeping process the alarm clock signal? Is that portable? Are you
> sure? What were you thinking of here?
I'm never sure of anything. :-) But here's the first part of what
perlfunc says about sleep:
Causes the script to sleep for EXPR seconds, or forever if no EXPR.
May be interrupted by sending the process a SIGALRM.
As far as portable, I'd say it's sure not going to work on systems that
don't support signals. But I'd expect it to work on Unix-like systems.
(BTW, I believe that other signals work as well as SIGALRM, even though
the current perl docs don't say so. I seem to recall a docpatch in the
works on that, and my systems sleep(3c) manpage supports the notion.)
On systems which don't support signals, there may not really be a way to
wake a sleeping process before it gets its full forty winks. But your
solution of periodically checking for an external condition might suffice.
Is that what you needed? Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 19 Jun 1998 15:25:47 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: [Q] On WAKING a sleeping process...
Message-Id: <6medvr$lot$1@monet.op.net>
In article <Pine.GSO.3.96.980619114752.15366H-100000@user2.teleport.com>,
Tom Phoenix <rootbeer@teleport.com> wrote:
>On systems which don't support signals, there may not really be a way to
>wake a sleeping process before it gets its full forty winks.
Even on systems that do support signals I think it may not be
possible. I don't think unix v7 sleep worked that way. Maybe Randal
or someone can verify this.
------------------------------
Date: 19 Jun 1998 19:48:18 GMT
From: smcdow@arlut.utexas.edu (Stuart McDow)
Subject: Re: [Q] On WAKING a sleeping process...
Message-Id: <6mefa2$5tn$1@ns1.arlut.utexas.edu>
mjd@op.net (Mark-Jason Dominus) writes:
>
> I would have said to use a busy-loop like this:
>
> # Name of file whose presence awakens Sleeping Beauty
> use constant HEY_WAKE_UP => 'wake_up_you_slug';
>
> $nap_start = time;
> while (time < $nap_start + 3600) { # Nap for one hour
> sleep 300; # Doze for five minutes
> if (-e HEY_WAKE_UP) {
> do_something_interesting();
> unlink HEY_WAKE_UP;
> # Possibly reset $nap_start now.
> }
> }
Gee, I was thinking of something like this...
(send the process a SIGUSR1 to make it do something, otherwise it'll
do that thing every SLEEP_TIME seconds)
$SIG{USR1} = sub { print "caught a USR1\n"; };
use constant SLEEP_TIME => 3600; # seconds
for(;;) {
my $napped_time = 0;
while($nap_time < SLEEP_TIME) {
$nap_time += sleep(SLEEP_TIME - $nap_time);
do_something_interesting();
}
}
This is pretty rudimentry. It would be better to wrap the sleep() call
in an eval and use die() in the signal handler, and disable the
SIGUSR1 during do_something_interesting(), but you get the general
picture.
--
Stuart McDow Applied Research Laboratories
smcdow@arlut.utexas.edu The University of Texas at Austin
"Look for beauty in roughness, unpolishedness"
------------------------------
Date: 19 Jun 1998 19:28:46 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: Abigail's Line [Was: regex terminator not allowed in comment in extended regex?]
Message-Id: <eli$9806191525@qz.little-neck.ny.us>
In comp.lang.perl.misc, John Adams <John.Adams@BentonvilleAR.ncr.com> wrote:
> Abigail wrote:
> > perl -wle 'print "Prime" if ("m" x shift) !~ m m^\m?$|^(\m\m+?)\1+$mm'
> I'm getting this message when I try this at home (well, not at my
> _dwelling_, but at my location described in "Hey, kids! Don't try this
> at home!"):
>
> Use of uninitialized value at -e line 1.
>
> What's the deal? And why am I unable to figure this out myself? (Well, I
> might be able to answer _that_ question...)
Give the one-liner an argument:
:r! perl -wle 'print "Prime" if ("m" x shift) !~ m m^\m?$|^(\m\m+?)\1+$mm'
Use of uninitialized value at -e line 1.
:r! perl -wle 'print "Prime" if ("m" x shift) !~ m m^\m?$|^(\m\m+?)\1+$mm' 17
Prime
Elijah
------
thinks it is the "x shift" bit that is confusing
------------------------------
Date: 19 Jun 1998 19:18:31 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Abigail's Line [Was: regex terminator not allowed in comment in extended regex?]
Message-Id: <6medi7$98$2@marina.cinenet.net>
John Adams (John.Adams@BentonvilleAR.ncr.com) wrote:
: Abigail wrote:
:
: > perl -wle 'print "Prime" if ("m" x shift) !~ m m^\m?$|^(\m\m+?)\1+$mm'
:
: I'm getting this message when I try this at home (well, not at my
: _dwelling_, but at my location described in "Hey, kids! Don't try this
: at home!"):
:
: Use of uninitialized value at -e line 1.
I'd guess you're not giving it an argument; you need to do e.g.
perl -wle 'print "Prime" if ("m" x shift) !~ m m^\m?$|^(\m\m+?)\1+$mm' 157
to test 157 for primeness. That's because that shift in there refers to
@ARGV, which will be empty if you don't provide an arg, then the
string-multiplier ("m" x shift) will spit out the warning (and create a
string of 0 copies of "m" -- that is, an empty string).
: What's the deal? And why am I unable to figure this out myself? (Well, I
: might be able to answer _that_ question...)
:)
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Fri, 19 Jun 1998 14:18:39 -0500
From: Bryan Camp <b-camp@students.uiuc.edu>
Subject: Re: Appending one file to another
Message-Id: <Pine.SOL.3.96.980619141747.22599A-100000@ux8.cso.uiuc.edu>
On Fri, 19 Jun 1998, Deva Seetharam wrote:
>
>
> Tom Phoenix wrote:
>
> > On Fri, 19 Jun 1998, Deva Seetharam wrote:
> >
> > > print HEAD <TAIL>;
> > >
> > > <TAIL> returns all the records pointed by TAIL file handle.
> >
> > While that works, it may be significant that it will read all of the
> > (remaining) lines from TAIL before it starts printing - in other words, it
> > temporarily loads all of the file into memory. It's generally more
> > memory-efficient to print just one line at a time in a loop. (Whether it's
> > faster or slower depends upon many factors, including how rapidly your
> > system can allocate memory. If speed is a major concern, though, I'd use
> > read() with a buffer of 8192 instead of the line input operator.)
> >
> > print HEAD while <TAIL>;
> >
> > Cheers!
> >
> > --
> > Tom Phoenix Perl Training and Hacking Esperanto
> > Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
>
> Thanks for pointing out.
> I apologize, if my solution had created any inconvenience to
> Bryan Camp. (one who asked this question.)
>
> Deva
>
>
>
Not confusing at all, it's working now.
Thank you very much for your help.
Bryan
------------------------------
Date: 19 Jun 1998 19:10:51 GMT
From: boyd@Ra.MsState.Edu (Boyd Nation)
Subject: Copying an Anonymous Hash
Message-Id: <6med3r$a68$1@nntp.msstate.edu>
I've been a good boy and checked both the FAQ and DejaNews and can't find
the answer to this one. Any help would be appreciated.
I need to be able to copy the contents of a hard reference to an anonymous
hash, and can't seem to find the correct syntax.
# This constructs the original hash:
$h1 = {
"m1" => 1,
"m2" => 2
};
# None of these work:
$h2 = $$h1;
$$h2 = $$h1;
$h2 = \($$h1);
All of these give
Not a SCALAR reference at ././test.pl line N.
I can, of course, do
$h2 = $h1;
but that just gives a copy of the reference and not of the contents.
Is there no way to do this without doing a key-by-key copy?
--
Boyd Nation System Administrator, Southern Company boyd@emss.com
Graduate Student, Mississippi State http://www2.msstate.edu/~boyd/
------------------------------
Date: Fri, 19 Jun 1998 19:18:41 GMT
From: mcafee@qbert.rs.itd.umich.edu (Sean McAfee)
Subject: Re: Copying an Anonymous Hash
Message-Id: <lQyi1.392$24.2142777@news.itd.umich.edu>
In article <6med3r$a68$1@nntp.msstate.edu>,
Boyd Nation <boyd@Ra.MsState.Edu> wrote:
>I need to be able to copy the contents of a hard reference to an anonymous
>hash, and can't seem to find the correct syntax.
># This constructs the original hash:
>$h1 = {
> "m1" => 1,
> "m2" => 2
>};
># None of these work:
>$h2 = $$h1;
>$$h2 = $$h1;
>$h2 = \($$h1);
>Is there no way to do this without doing a key-by-key copy?
Yes:
$h2 = { %$h1 };
--
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
| K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
| tv+ b++ DI++ D+ G e++>++++ h- r y+>++** | umich.edu
------------------------------
Date: 19 Jun 1998 19:41:19 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Copying an Anonymous Hash
Message-Id: <6meesv$98$3@marina.cinenet.net>
Boyd Nation (boyd@Ra.MsState.Edu) wrote:
: I need to be able to copy the contents of a hard reference to an anonymous
: hash, and can't seem to find the correct syntax.
:
: # This constructs the original hash:
: $h1 = {
: "m1" => 1,
: "m2" => 2
: };
:
: # None of these work:
: $h2 = $$h1;
: $$h2 = $$h1;
: $h2 = \($$h1);
But this does:
%h2 = %$h1;
All your $$ prefixes on the RHSs above are saying "the scalar refered to
by the scalar h1," while the correct version says "the hash refered to by
the scalar h1." I'd suggest renaming $h1 (or the equivalent name you're
really using) to $h1r or $hr1 or the like to emphasize it's being a
reference to a hash, not a hash.
: All of these give
:
: Not a SCALAR reference at ././test.pl line N.
Yeah, because it isn't. :)
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: 19 Jun 1998 19:44:32 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Copying an Anonymous Hash
Message-Id: <6mef30$98$4@marina.cinenet.net>
Sean McAfee (mcafee@qbert.rs.itd.umich.edu) wrote:
: >Is there no way to do this without doing a key-by-key copy?
:
: $h2 = { %$h1 };
No need for that anon-hash-ctor wrapper, which actually just wastes a
whole lot of processing time to achieve exactly the same effect as
$h2 = %$h1;
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: 19 Jun 1998 15:05:09 -0400
From: Dan Schmidt <dfan@harmonixmusic.com>
Subject: Re: Efficiency: required reading
Message-Id: <wkemwlyzyy.fsf@turangalila.harmonixmusic.com>
petdance@maxx.mc.net (Andy Lester) writes:
| "Writing Efficient Programs" by Jon Bentley. Don't be scared that
| it's 16 years old. It's a programming book for the ages.
And it's out of print. What a travesty.
If you see this book used, BUY IT, cause you're not getting my copy.
Truly a classic.
--
Dan Schmidt -> dfan@harmonixmusic.com, dfan@alum.mit.edu
Honest Bob & the http://www2.thecia.net/users/dfan/
Factory-to-Dealer Incentives -> http://www2.thecia.net/users/dfan/hbob/
Gamelan Galak Tika -> http://web.mit.edu/galak-tika/www/
------------------------------
Date: 19 Jun 1998 15:10:44 -0400
From: mwmaurer@mtu.edu (Mark Maurer)
Subject: Re: first language
Message-Id: <6med3k$reb$1@pace1.cts.mtu.edu>
Abigail (abigail@fnx.com) wrote:
: Randal Schwartz (merlyn@stonehenge.com) wrote on MDCCLIII September
: MCMXCIII in <URL: news:8cbtrpbgn2.fsf@gadget.cscaper.com>:
: ++ >>>>> "Dan" == Dan Nguyen <nguyend7@egr.msu.edu> writes:
: ++
: ++ Dan> The person needs to be a "natural" programmer. Generally I feel that
: ++ Dan> most people have hard time not with the language but with the process
: ++ Dan> of programming. A person could learn Perl as a first language very
: ++ Dan> easily and have no problems, while others could become stuck on the
: ++ Dan> syntax of the language.
: ++
: ++ I'll second this. I see far too many people *attempting* programming
: ++ that would probably have a better time being firefighters or line
: ++ chefs or congressmen or something. Sure, maybe nearly anyone with
: ++ enough effort can hack out a VB script to automate a repeated task,
: ++ but programming *well* seems to require a twisted aptitude only some
: ++ small percentage of the population seems to have. I think I was lucky
: ++ to be born with it, given the time at which I was born. :-) No
: ++ ordinary amount of education can seem to teach people how to "think"
: ++ like a progammer. ("You have these seven transformations possible and
: ++ this problem requires converting Q to W... go!")
: ++
: ++ I suppose it would be too much to ask that if you're not a natural
: ++ programmer, either stay out of the business, or flag your work
: ++ properly so that we cleanup people know what to throw out first. :-)
:
:
: That sounds as if programming would be an art. I disagree with that.
: I believe that most people can be able to learn how to program. Just
: like most people could learn how to become a car mechanic.
I used to think that way, but not anymore. Sometimes, it still seems as if
it is that way, but it really isn't. No more than I have a good chance at
being a good Chemical Engineer or Architect. I can learn some of the
concepts behind it, but that is as far as it goes.
There is a difference in knowing how to do something, and knowing how to do
something well...
: Whether everyone has the motivation to learn is a different issue.
I agree with this 100%
--
Mark Maurer markm@dct.com mwmaurer@mtu.edu
Programmer, Digital Magic Interactive http://www.dminteractive.com
Senior, Michigan Technological University Houghton, MI
-- Views do not represent those of my employer or school
------------------------------
Date: Fri, 19 Jun 1998 19:38:03 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Flames....
Message-Id: <Pine.GSO.3.96.980619121251.15366M-100000@user2.teleport.com>
On 19 Jun 1998, Michael J Gebis wrote:
> The faq is big. The docset for perl is big. This is a good thing,
> but it is not without problems. It's hard to find stuff if you lack
> context.
A _few_ things may be hard to find, but the vast majority are easy to grep
within a few seconds. (I know, someone out there is saying, "But I don't
have grep! I've paid big money to Bill Gates so that I won't have it." I'm
using the word in a generic sense - even on a Billbox, you should have a
way to search for a string within a file. Even if you can search only one
file at a time, you can start with perltoc or perlfunc and usually get a
good pointer there. If nothing else works, you should re-write grep in
Perl. :-)
If you can't find something after a reasonable try, though, no one should
flame you for asking here. Instead, we should see about improving the docs
so that they'll help someone in the future.
On the other hand, when someone fails to even _try_ to find an answer,
firm discipline may encourage a little future effort. As the saying goes,
if you give a man a fish, he eats for a day. If you teach him to grep for
fish, he'll leave you alone all weekend. If you encourage him to beg for
fish, pretty soon c.l.p.misc will smell like a three-week-dead trout. I'm
sure that saying goes something like that....
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 19 Jun 1998 19:10:14 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: How to scrub Ctl-Z?
Message-Id: <6med2m$98$1@marina.cinenet.net>
Greg Carey (gacarey@domain.com) wrote:
: >>Try using binmode() to get into binary-read mode. After that, you should
: >>slurp the entire file as a single operation into a scalar (undef $/) and
: >>operate on that.
:
: I hate to trouble you, but I cannot get the syntax correct for the above.
: I've never used Perl before and it's a bit unlike my other languages. I need
: to open a filename that's passed in (it's different every day & about 20MB),
: scrub it, and save it to another filename, also passed in. I'm using NT 3.51.
OK, here's what you want, untested under DOS but it works (as a no-op)
under Unix:
#!/usr/bin/perl -w
# scrub - scrubs ctrl-z to space on first arg, writing to second
# arg.
# Craig Berry (19980619)
use strict;
die "Useage: $0 infile outfile\n" unless @ARGV == 2;
my ($in, $out) = @ARGV;
open IN, "< $in" or die "Can't open $in: $!\n";
open OUT, "> $out" or die "Can't open $out: $!\n";
binmode IN;
binmode OUT;
local $/;
my $text = <IN>;
$text =~ tr/\cZ/ /;
print OUT $text;
close OUT;
close IN;
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Fri, 19 Jun 1998 12:30:49 -0700
From: Greg Carey <gacarey@domain.com>
Subject: Re: How to scrub Ctl-Z?
Message-Id: <358ABC69.E9B1D52F@domain.com>
Thank you _very_ much! It works great and will save me a lot of grief!
Craig Berry wrote:
> OK, here's what you want, untested under DOS but it works (as a no-op)
> under Unix:
>
> ---------------------------------------------------------------------
> | Craig Berry - cberry@cinenet.net
> --*-- Home Page: http://www.cinenet.net/users/cberry/home.html
> | Member of The HTML Writers Guild: http://www.hwg.org/
> "Every man and every woman is a star."
------------------------------
Date: Fri, 19 Jun 1998 15:44:47 -0400
From: "Michael S. Brito, Jr." <mike@newfangled.com>
To: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Little help on grabbing text
Message-Id: <358ABF98.A4AD6F9C@newfangled.com>
Thanx, seriously. You and Tom are providing some good tips. I've only been at
this for like 3 weeks so I need all the help I can get! Here is how I fixed
my problem (before reading your posting):
$filename = "body.txt";
$T = $/;
$/ = "";
open(INF,$filename);
$indata = <INF>;
close(INF);
$/ = $T;
assuming I add your suggested code is there anything else I should
try/add?????
Ala Qumsieh wrote:
> Michael S. Brito, Jr. wrote:
> >
> > I'm kinda new to this so bear with me:
> >
> > I'm writing a script that will grab a users e-mail address from a form
> > that he/she fills out. It will then slap it in a file (email.txt). Then
> > It will grab whatever is in the file body.txt and use it for the body of
> > an e-mail which is then sent to that users input (or e-mail address).
> > One problem though, I can only grab the first line of body.txt! I don't
> > know how to grab the entire thing and send it away. I *think* it's a
> > FOREACH thing but I experimented with no luck.
> >
>
> [snip some code]
>
> > $filename = "body.txt";
> > open(INF,$filename);
>
> ALWAYS check the result of your open statements!
> open INF, "body.txt" or die "Can't open body.txt: $!\n";
>
> > $indata = <INF>;
>
> You are reading the first line only! To read the entire thing, you can
> do any of the following:
>
> 1) @indata = <INF>; # This creates an array. Each element is a
> # line from the file
>
> 2) $/ = ""; # This redefines your input record separator
> $indata = <INF>; # Now the whole file is read as one scalar, with
> # carriage returns and all.
>
> 3) while (<INF>) {
> print MAIL "$_";
> }
>
> > close(INF);
>
> again, you should check the result of the close.
> >
> > print MAIL "$indata\n";
> >
> > close(MAIL);
> >
> > print "Location:http://208.XXX.XXX.XXX/thanks.html\n\n";
> >
> > !--------------- EOF --------------------!
> >
> > Thanks for any help u can offer,
> >
> > Mike : mike@newfangled.com
>
> Buy yourself a copy of the Llama book by R. Schwartz and T.
> Christiansen.
>
> --
> Ala Qumsieh | No .. not just another
> ASIC Design Engineer | Perl Hacker!!!!!
> Matrox Graphics Inc. |
> Montreal, Quebec | (Not yet!)
-----------------------------------------------------------
Michael S. Brito, Jr., Web Developer
Newfangled Graphics Co. Inc.
mike@newfangled.com
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=(#####censored######)
-----------------------------------------------------------
------------------------------
Date: Fri, 19 Jun 1998 15:51:37 -0400
From: "Michael S. Brito, Jr." <mike@newfangled.com>
To: Rahul Dhesi <c.c.eiftj@98.usenet.us.com>
Subject: Re: ohsir.pl : suggestive perl poem
Message-Id: <358AC132.3D08A4A2@newfangled.com>
HAHAHHAHHA. Oh that is bad....... I LIKE IT!
;-)
Rahul Dhesi wrote:
> #! /usr/local/bin/perl
> # (c) Copyright Rahul Dhesi 1998; permission granted to copy provided
> # this copyright statement is preserved.
> # I claim no copyright over the output, only over the perl code.
> # WARNING: The output is a suggestive poem suitable for adults.
>
> for ($line = "oh sir please don't touch me"; $count++ < 8; ) {
> print $line, " ...\n"; $line =~ s/ \S+$//; sleep 3; }
> # end
-----------------------------------------------------------
Michael S. Brito, Jr., Web Developer
Newfangled Graphics Co. Inc.
mike@newfangled.com
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=(#####censored######)
-----------------------------------------------------------
------------------------------
Date: Fri, 19 Jun 1998 19:49:53 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Pod::Text -- Unix only?
Message-Id: <Pine.GSO.3.96.980619124243.15366N-100000@user2.teleport.com>
On Fri, 19 Jun 1998, Michael D. Schleif wrote, referring to Tom
Christiansen:
> I don't presume to speak for Tom -- we have had our share of words
> between us -- but, anybody care to ship Tom a Mac?
Oddly enough, "Tom Christiansen" anagrams to "Insert Macintosh".
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 19 Jun 1998 15:01:43 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Reference to arrays
Message-Id: <6mecin$lg3$1@monet.op.net>
In article <6mdv8p$inh$1@monet.op.net>, Mark-Jason Dominus <mjd@op.net> wrote:
>A Perl array contains slots that each contain one `SV' (scalar value)
>structure. When you ask for $r = \$q[0], you get a reference to the
>SV. If you then do $q[0] = 7, the SV in the array is replaced with a
>new SV. $r still refers to the old SV, not to the new one. What you
>want is for $r to point to a slot in the array, not to the SV.
This is totally wrong.
The moral of the story here is not that you should test your theories
before you shoot off your mouth, because I did do that. The moral is
that you should examine the output of your tests.
My apologies to anyone who was deceived here.
Thanks to Guy Decoux for pointing this out to me.
------------------------------
Date: Fri, 19 Jun 1998 19:03:50 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Regular Expression Question
Message-Id: <Pine.GSO.3.96.980619120000.15366J-100000@user2.teleport.com>
On Fri, 19 Jun 1998, Laura Morgan wrote:
> Subject: Regular Expression Question
Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
> I have input parameters that can be file.name, *.ext, file.* or *.* I'm
> parsing through a file trying to match on this input and perform a
> function (i.e. if the user types in *.c, I want to match all files with
> a .c extension, etc).
>
> With the input variable name being $file, and the match against variable
> named $matchfile, is there a way I can make a comparison that will match
> $file with $matchfile, using the wildcard scenerio mentioned above?
If I understand your question, the answer is yes; you can build a regular
expression from a glob pattern, then you can see what matches. For
example, '.' in your glob can become a backslashed dot, and '*' can become
'.*' or whatever you need. (I'm not sure whether you mean for '*.*' to
include all files, or merely the ones containing a dot, or what.)
On the other hand, perhaps you simply want the glob function.
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 19 Jun 1998 01:59:20 -0500
From: "Chris" <chris@nemonet.com>
Subject: Re: Running a VT100 perl script in Windows 95
Message-Id: <6mecfm$m3n$1@news4.ispnews.com>
Tom Phoenix wrote in message ...
+AD4-On 18 Jun 1998, Phoenixl wrote:
+AD4-
+AD4APg- Can someone tell me where I could find cursor
+AD4APg- movement strings for the MS-DOS window?
+AD4-
+AD4-I think you're looking for documentation, rather than the strings
+AD4-themselves. Perhaps the docs, FAQs, and newsgroups about MS-DOS could be
Tom's right, not exactly a Perl question. But the DOS console has no cursor
control strings. It can use a driver such as ANSI.SYS (which would work with
the VT100
strings which are basically ANSI) to interpret currsor control strings.
ANSI.SYS is included in any recent version of PCDOS or MSDOS, including
MSDOS 7.0 (aka
Windows 95...).
It's in c:+AFw-windows+AFw-command by default, and can be selectively loaded into
some DOS sesions and not others. For info on tis go to a DOS or Windows or
general MS
newsgroup.
+AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQ-
Chris Stith
Asst. Network Administrator
DataStream Networks, Inc.
chris+AEA-nemonet.com
-----------------------------------------------------------------
+ACI-Every program should do as much as is necessary, but much less
than what is possible.+ACI- -- Anonymous
------------------------------
Date: Fri, 19 Jun 1998 19:08:13 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: setuid problem
Message-Id: <Pine.GSO.3.96.980619120521.15366K-100000@user2.teleport.com>
On Thu, 18 Jun 1998, Zach Malchano wrote:
> I'm in the process of writing a setuid/setgid program, but I'm having a
> large problem w/ taint checking. The program gets a username and
> password via CGI (html form), but will not allow a file handle:
Filehandles can't be passed through the CGI interface! Maybe you mean a
filename or something?
> $path = "/home/$username/www/index.html";
When you start in the middle of your program, of course you are leaving
something out. What is $username, and is it tainted? If it is, then $path
is as well.
> $fh = new FileHandle "$path", "w" or die "Can't open $!\n";
Those double quotes around $path are spurious. And if you're trying to
open a tainted filename for writing, Perl is supposed to stop you.
See the perlsec manpage for more about these issues. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 19 Jun 1998 19:32:38 GMT
From: dougb@world.std.com (doug a blaisdell)
Subject: Soundcard Control via Perl ioctl()?
Message-Id: <EutCyE.6BG@world.std.com>
hi everbuddy!
I'd like to play wav files from Perl, on Linux, using (i guess) ioctl() calls
from Perl, based on soundcard.h.
Anyone know how to do this? I ran h2ph on ioctl.h and soundcard.h, but I
don't think the values are correct, since the same ioctl()S in C work and
those from Perl don't. I've never used ioctl()s from Perl, though (or
h2ph, for that matter). Is there a FAQ on ioctl, device control, and Perl?
thanks,
doug
------------------------------
Date: 19 Jun 1998 19:03:39 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: the ?PATTERN? match syntax
Message-Id: <6mecmb$luv$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Eli the Bearded
<*@qz.to>],
who wrote in article <eli$9806191315@qz.little-neck.ny.us>:
> > I'm not trying to start an argument; I'm really curious. A few months
> > ago I tried to make a list of the least-known and littlest-used Perl
> > features. I polled some experienced Perl programmers for advice.
> > When I mentioned ?PATTERN? to them, most of them didn't know what I
> > was referring to.
>
> It should be documented in perlre, and not just perlop.
No. Perlre is about RE, and there is no difference between REs in
/RE/ and ?RE?.
Ilya
------------------------------
Date: 19 Jun 1998 19:47:03 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: the ?PATTERN? match syntax
Message-Id: <eli$9806191529@qz.little-neck.ny.us>
In comp.lang.perl.misc, Ilya Zakharevich <ilya@math.ohio-state.edu>
followed up to me:
> > It should be documented in perlre, and not just perlop.
> No. Perlre is about RE, and there is no difference between REs in
> /RE/ and ?RE?.
Yes but it does change the way the RE works. This works differently
with ?s than it would without them.
@foo = grep ?RE?, @whatever;
I'm not saying that this should be removed from perlop, just that
people looking for information about REs tend not to think to look
in that section and instead look at perlre. Putting information
where people will look for it is a good thing. Maybe in a caveats
section.
Elijah
------
recognizes this is a philosphy issue
------------------------------
Date: Fri, 19 Jun 1998 18:13:40 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: unzip using perl
Message-Id: <Pine.GSO.3.96.980619111323.15366B-100000@user2.teleport.com>
On Fri, 19 Jun 1998 userjeff@my-dejanews.com wrote:
> I am looking for a way( by using perl) that can
> unzip a zipped file. Can anybody help me?
If there's a module which does what you want, it should be listed in
the module list on CPAN. If you don't find one to your liking, you're
welcome and encouraged to submit one! :-) Hope this helps!
http://www.perl.org/CPAN/
http://www.perl.com/CPAN/
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
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 2914
**************************************