[17138] in Perl-Users-Digest
Perl-Users Digest, Issue: 4550 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 7 18:05:24 2000
Date: Sat, 7 Oct 2000 15:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <970956307-v9-i4550@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 7 Oct 2000 Volume: 9 Number: 4550
Today's topics:
Re: [UPDATE] mod_perl and ActiveState perl (v5.6.0 618) <jbaker6953@yahoo.com>
attaching a gif : Content-Transfer-Encoding <jtjohnston@courrier.usherb.ca>
Re: attaching a gif : Content-Transfer-Encoding <tony_curtis32@yahoo.com>
Re: Best definition of Perl so far in 19100 <jdb@wcoil.com>
Re: Best definition of Perl so far in 19100 <jeff@vpservices.com>
Re: Best definition of Perl so far in 19100 <uri@sysarch.com>
Re: Best definition of Perl so far in 19100 <jeff@vpservices.com>
Re: Best definition of Perl so far in 19100 (brian d foy)
Re: Best definition of Perl so far in 19100 <mauldin@netstorm.net>
currency format <theborg@usa.com>
Re: currency format <jeff@vpservices.com>
Re: How can I set and read a variable like the session- <mbudash@sonic.net>
Re: How do I get a cgi script to load a url <jeff@vpservices.com>
Re: How do I get a cgi script to load a url (Randal L. Schwartz)
Re: How do I get a cgi script to load a url <jeff@vpservices.com>
Re: how to pass info to a script? <mbudash@sonic.net>
Re: modifying elements in an each() loop <cbilson@mailandnews.com>
Re: Netscape supports Perl ? <bart.lateur@skynet.be>
Re: Please help on "processing data problem" <bart.lateur@skynet.be>
Re: PP, 3rd ed.??? (Tim Hammerquist)
Re: PP, 3rd ed.??? <kj0@mailcity.com>
STDIN question <kulabocca69@hotmail.com>
Text file manipulation <@tampabay.rr.com>
Re: What does PERL stand for? <rpolzer@web.de>
Re: What does PERL stand for? <anmcguire@ce.mediaone.net>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 07 Oct 2000 20:54:55 GMT
From: Jerry Baker <jbaker6953@yahoo.com>
Subject: Re: [UPDATE] mod_perl and ActiveState perl (v5.6.0 618)
Message-Id: <39DF8D9E.B26EEC07@weirdness.com>
Randy Kobes wrote:
>
> I'm not sure then what to suggest on the mod_perl/perl side ....
> Would it be possible for you to try mod_perl out with
> apache-1.3.13-dev? There's a few service-related changes
> in that ... I'm not sure if the mod_perl ppm package will
> work with that, though, even from the command line,
> as it was compiled against apache-1.3.12. If it doesn't work,
> let me know and I'll make a ppm compiled against 1.3.13-dev.
> Thanks.
>
> best regards,
> randy kobes
That's what I was testing it with.
--
Jerry Baker
PGP Key:
http://pgpkeys.mit.edu:11371/pks/lookup?op=get&search=0x8B9F6300
------------------------------
Date: Sat, 07 Oct 2000 16:33:20 -0400
From: jtjohnston <jtjohnston@courrier.usherb.ca>
Subject: attaching a gif : Content-Transfer-Encoding
Message-Id: <39DF8890.794F@courrier.usherb.ca>
I am using this script to attached 2 graphics. Only one attaches
correctly, the other comes out as scrap, as binary text. It will work
and one graphic will attach correctly, IF these lines are commented out.
How can I get the second to attach correctly?
Thanks,
John
P.S. I know my news server is screwing up my threads. A Post & Reply
would be real helpful!
$mailinfo.= "--======================_888227034==_
Content-Type: $content_type1\n";
$mailinfo.= "Content-Transfer-Encoding: $encoding1\n";
$mailinfo.= "Content-Disposition: inline;
filename=\"quebec-left.gif\"\n\n";
$mailinfo.= "$b64image1";
#It will work and one graphic will attach correctly, IF these lines are
commented out.
# $mailinfo.= "\n\n\n";
# $mailinfo.= "--======================_888227034==_--";
# $mailinfo.= "--======================_888227034==_
# Content-Type: $content_type2\n";
# $mailinfo.= "Content-Transfer-Encoding: $encoding2\n";
# $mailinfo.= "Content-Disposition: inline;
filename=\"$quebec-right.gif\"\n\n";
# $mailinfo.= "$b64image2";
$mailinfo.= "\n\n\n";
$mailinfo.= "--======================_888227034==_--";
###############################################################
$content_type1 = "image/gif; name=\"quebec-left.gif\";
x-mac-type=\"47494666\"; x-mac-creator=\"4A565752\"";
$encoding1 = "base64";
open(IMAGE, "/home01/eslcafe/public_html/graphics/quebec-left.gif");
binmode (IMAGE);
undef $/; $rawimage = <IMAGE>; $/ = "\n";
close IMAGE;
$b64image1 = &encode_base64 ($rawimage);
chomp $b64image1;
#############################################
$content_type2 = "image/gif; name=\"quebec-right.gif\";
x-mac-type=\"47494666\"; x-mac-creator=\"4A565752\"";
$encoding2 = "base64";
open(IMAGE, "/home01/eslcafe/public_html/graphics/quebec-right.gif");
binmode (IMAGE);
undef $/; $rawimage = <IMAGE>; $/ = "\n";
close IMAGE;
$b64image2 = &encode_base64 ($rawimage);
chomp $b64image2;
my $mailinfo;
$mailinfo = "Reply-to: $Admin_Name <$Admin_Email>\n";
$mailinfo = "From: $Admin_Name <$Admin_Email>\n";
$mailinfo.= "To: $in{'contact-name'} <$in{'email'}>\n";
$mailinfo.= "Subject: $title Submission\n";
$mailinfo.= "Mime-Version: 1.0\n";
$mailinfo.= "Content-type: multipart/mixed;
boundary=\"======================_888227034==_\"\n";
$mailinfo.= "--======================_888227034==_
Content-Type: text/plain; charset=us-ascii";
$mailinfo.= "\n\n";
$mailinfo.= "Vous trouverez les images qu'il vous faut attachées,
ci-dessous. You will find the graphics you need attached below.\n\n";
$mailinfo.= "--======================_888227034==_
Content-Type: $content_type1\n";
$mailinfo.= "Content-Transfer-Encoding: $encoding1\n";
$mailinfo.= "Content-Disposition: inline;
filename=\"quebec-left.gif\"\n\n";
$mailinfo.= "$b64image1";
# $mailinfo.= "\n\n\n";
# $mailinfo.= "--======================_888227034==_--";
# $mailinfo.= "--======================_888227034==_
# Content-Type: $content_type2\n";
# $mailinfo.= "Content-Transfer-Encoding: $encoding2\n";
# $mailinfo.= "Content-Disposition: inline;
filename=\"$quebec-right.gif\"\n\n";
# $mailinfo.= "$b64image2";
$mailinfo.= "\n\n\n";
$mailinfo.= "--======================_888227034==_--";
&output_to_file($mailinfo, "|$mailprogram -t");
sub encode_base64 ($;$) {
my $res = "";
my $eol = $_[1];
$eol = "\n" unless defined $eol;
while ($_[0] =~ /(.{1,45})/gs) {
$res .= substr (pack ('u', $1), 1);
chomp ($res);
}
$res =~ tr|` -_|AA-Za-z0-9+/|; # `# help emacs
my $padding = (3 - length($_[0]) % 3) % 3;
$res =~ s/.{$padding}$/'=' x $padding/e if $padding;
if (length $eol) { $res =~ s/(.{1,76})/$1$eol/g; }
$res;
}
sub output_to_file{
# get params
my $output = @_[0];
my $file = @_[1];
# test params
if($output eq '' || $file eq '') {
die &error(' Usage for &output_to_file(); (OUTPUT,
FILENAME)'); }
# open the file
open(FILE, $file) || &error("Unable to open $file. Reason:$!");
# lock file
unless($file =~ /$mailprogram/ || $FLOCK eq 'no'){ flock(FILE, 2) ||
die &error(" Unable to obtain a lock on file: $file. Reason:
$!"); }
# print to file
print FILE "$output";
# close file
close(FILE);
}
------------------------------
Date: 07 Oct 2000 15:47:07 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: attaching a gif : Content-Transfer-Encoding
Message-Id: <874s2ojs50.fsf@limey.hpcc.uh.edu>
>> On Sat, 07 Oct 2000 16:33:20 -0400,
>> jtjohnston <jtjohnston@courrier.usherb.ca> said:
> I am using this script to attached 2 graphics. Only one
> attaches correctly, the other comes out as scrap, as
> binary text. It will work and one graphic will attach
> correctly, IF these lines are commented out. How can I
> get the second to attach correctly?
Why all the hard work?
http://search.cpan.org/
and look for "MIME". Specifically, MIME::Lite sounds
perfectly suited to your task.
hth
t
--
Namaste!
And an "oogabooga" to you too!
-- Homer Simpson
------------------------------
Date: 7 Oct 2000 19:37:28 GMT
From: "Josiah" <jdb@wcoil.com>
Subject: Re: Best definition of Perl so far in 19100
Message-Id: <8rnu1o$jpi$0@206.230.71.21>
Umm... hey _I_ disagree...guess what, Im not a perl guru tho. Sorry.
However, I _do_ have evidence AGAINST the stated 'fact' that Perl's
"main purpose is to add interactivity to a website." I find that
http://www.cpan.org/modules/by-module/ proves very nicely that
there is MUCH MUCH more to Perl than /just/ interactive websites!
To quote one of Perl guru's, Randal Schwartz, "most of the web uses
Perl, but most of Perl usage is not about the web." (That quote is from
every autoresponse when you send to CLPA.) I hope that this
will clear up some of your misunderstandings about Perl. (Oh, btw,
Perl and CGI are _/NOT/_ synonymous.)
Cheers!
--
Josiah Bryan
jdb@wcoil.com
-----------------------------------------------------------------------
Pursuant to US Code, Title 47, Chapter 5, Subchapter II, ¢227,
Any and all nonsolicited commercial E-mail sent to this address
is subject to a download and archival fee in the amount of $500.00 US.
E-Mailing denotes the acceptance of these terms
-----------------------------------------------------------------------
Rosemary I H Powell <rosie@dozyrosy.plus.com> wrote in message
news:MPG.144942fa6e1d490b9896e1@usenet.plus.net...
> 1) What is CGI?
> CGI (or Perl) is a specail Internet language that allows you
> to run 'programs'.....
>
> 2) What is it useful for?
> Perl is EXTREMELY useful. It's main purpose is to add
> interactivity to a website.....
>
> (found at http://members.freshhosting.co.uk/kb/cgi.html)
>
> Just in case any of you old Perl "gurus" believed differently.
>
> Rosemary
>
> --
> ----------------------------------------------------------------
> | Rosemary I.H.Powell EMail: Home: rosie@dozyrosy.plus.com |
> | Work: r.i.h.powell@rl.ac.uk |
> | http://NeedleworkSamplers.com/ |
> | http://www.CavalierKingCharles.com/ |
> ----------------------------------------------------------------
------------------------------
Date: Sat, 07 Oct 2000 12:43:01 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Best definition of Perl so far in 19100
Message-Id: <39DF7CC5.629E442A@vpservices.com>
Josiah wrote:
>
> Rosemary I H Powell <rosie@dozyrosy.plus.com> wrote in message
> news:MPG.144942fa6e1d490b9896e1@usenet.plus.net...
> > 1) What is CGI?
> > CGI (or Perl) is a specail Internet language that allows you
> > to run 'programs'.....
> >
> > 2) What is it useful for?
> > Perl is EXTREMELY useful. It's main purpose is to add
> > interactivity to a website.....
> >
> > (found at http://members.freshhosting.co.uk/kb/cgi.html)
> >
> > Just in case any of you old Perl "gurus" believed differently.
>
> Umm... hey _I_ disagree...
I think you missed something in Rosemary's posting:
perldoc -q "implicit smiley"
--
Jeff
------------------------------
Date: Sat, 07 Oct 2000 19:50:55 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Best definition of Perl so far in 19100
Message-Id: <x7og0w2zxc.fsf@home.sysarch.com>
>>>>> "JZ" == Jeff Zucker <jeff@vpservices.com> writes:
JZ> Josiah wrote:
>>
>> Rosemary I H Powell <rosie@dozyrosy.plus.com> wrote in message
>> >
>> > (found at http://members.freshhosting.co.uk/kb/cgi.html)
>> >
JZ> I think you missed something in Rosemary's posting:
JZ> perldoc -q "implicit smiley"
upon reading that stupid site, it is that they only support perl for cgi
for their nt lusers. they also recommend cgi resources, which is of
course the home of our dear friend matt wright. so anything they say
however humorous is to be ignored.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Sat, 07 Oct 2000 13:06:54 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Best definition of Perl so far in 19100
Message-Id: <39DF825E.4A6A75D8@vpservices.com>
Uri Guttman wrote:
>
> >>>>> "JZ" == Jeff Zucker <jeff@vpservices.com> writes:
>
> JZ> Josiah wrote:
> >>
> >> Rosemary I H Powell <rosie@dozyrosy.plus.com> wrote in message
> >> >
> >> > (found at http://members.freshhosting.co.uk/kb/cgi.html)
> >> >
> JZ> I think you missed something in Rosemary's posting:
>
> JZ> perldoc -q "implicit smiley"
>
> upon reading that stupid site, it is that they only support perl for cgi
> for their nt lusers. they also recommend cgi resources, which is of
> course the home of our dear friend matt wright. so anything they say
> however humorous is to be ignored.
Yah, sure, I agree 100% and I agree with what Josiah said too. And I
don't think the site was being humorous. Unfortunately I think they
believed what they were writing. It's Rosemary's reason for posting
that site here that had the humor in it. (at least I hope so)
--
Jeff
------------------------------
Date: Sat, 07 Oct 2000 17:23:42 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Best definition of Perl so far in 19100
Message-Id: <brian-ya02408000R0710001723420001@news.panix.com>
In article <MPG.144942fa6e1d490b9896e1@usenet.plus.net>, rosie@dozyrosy.plus.com posted:
> 1) What is CGI?
> CGI (or Perl) is a specail Internet language that allows you
> to run 'programs'.....
The Common Gateway Interface is not a langauge. it does not
allow you to run programs. it only specifies the interface
between two programs.
> 2) What is it useful for?
> Perl is EXTREMELY useful. It's main purpose is to add
> interactivity to a website.....
whatever. very little of Perl's use is for the web even
though Perl might be a lot of the web programming out there.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>
------------------------------
Date: Sat, 07 Oct 2000 21:35:06 GMT
From: Jim Mauldin <mauldin@netstorm.net>
Subject: Re: Best definition of Perl so far in 19100
Message-Id: <39DF96B7.437DEF94@netstorm.net>
brian d foy wrote:
>
> In article <MPG.144942fa6e1d490b9896e1@usenet.plus.net>, rosie@dozyrosy.plus.com posted:
>
> > 1) What is CGI?
> > CGI (or Perl) is a specail Internet language that allows you
> > to run 'programs'.....
>
> The Common Gateway Interface is not a langauge. it does not
> allow you to run programs. it only specifies the interface
> between two programs.
>
> > 2) What is it useful for?
> > Perl is EXTREMELY useful. It's main purpose is to add
> > interactivity to a website.....
>
> whatever. very little of Perl's use is for the web even
> though Perl might be a lot of the web programming out there.
>
Again, the subject line (19100) and general tenor of the message should
give you a hint as to the OP's intent. See also Jeff Zucker's message,
above, and the zillions of posts to clpm that confirm the idea.
-- Jim
------------------------------
Date: Sat, 07 Oct 2000 19:57:19 GMT
From: borg <theborg@usa.com>
Subject: currency format
Message-Id: <39DF8021.B556957A@usa.com>
Is there a quick a way to get output into a currency format? ie.
$12,000.00
Right now I am using: $var=("%4.2f", $var);
But that does not place the commas in there.
thanks,
Peter
------------------------------
Date: Sat, 07 Oct 2000 13:08:02 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: currency format
Message-Id: <39DF82A2.E8A2CD09@vpservices.com>
borg wrote:
>
> Is there a quick a way to get output into a currency format? ie.
> $12,000.00
>
> Right now I am using: $var=("%4.2f", $var);
>
> But that does not place the commas in there.
perldoc -q commas
--
Jeff
------------------------------
Date: Sat, 07 Oct 2000 11:17:52 -0700
From: Michael Budash <mbudash@sonic.net>
Subject: Re: How can I set and read a variable like the session-variable in ASP ?
Message-Id: <mbudash-E06B31.11175207102000@news.pacbell.net>
In article <EhFD5.684093$Kw2.6104877@flipper>, "Julien Stokkink"
<julien@stokkink.com> wrote:
> Can someone help me with the following:
>
> I want to set a variable that's filled with information
what information? i'll assume from your subject line that you mean a
unique id of some kind...
> during the period
> a user uses the .PL-scripts on my website,
> but I don't know how to do that !
>
> I want to use different .PL-scripts that read the content of such a
> variable.
>
> Can anyone help me ?
>
first, come up with the id. in perl, i often use:
$id = $$ . join ('', localtime());
you then merely have to be sure it's passed to every script. several
ways:
- hidden form fields
- on the url
- 'get' method:
http://www.domain.com/cgi-bin/script.pl?id=187364539)
- 'path_info' method:
http://www.domain.com/cgi-bin/script.pl/187364539
- etc.
hth-
--
Michael Budash ~~~~~~~~~~ mbudash@sonic.net
------------------------------
Date: Sat, 07 Oct 2000 11:13:51 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: How do I get a cgi script to load a url
Message-Id: <39DF67DF.B1D9016B@vpservices.com>
brian d foy wrote:
>
> In article <39DF477E.44091D94@vpservices.com>, Jeff Zucker
> <jeff@vpservices.com> wrote:
>
> > LOL, I actually had that in as number four, but when I checked the specs
> > (CGI 7.2.1.1 and HTTP 4.2), they did not, that I could find, mention the
> > space as required.
>
> you are referring to section numbers in unspecified versions
> of those specifications, perhaps? ;)
Ok, ok, I left out the versions and I didn't cut and paste. And (tho no
one has mentioned it yet) I am continuing to speak out on a subject that
doesn't have the remotest connection to the topic of this newsgroup. I
am now equal with the OP who scored 3 mistakes in one line of code.
Mine was 3 in one sentence. Mea culpa. Alan's already done the cut and
paste, here are the cites (and sites):
http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2
http://www.golux.com/coar/cgi/draft-coar-cgi-v11-03-clean.html#7.2.1.2
> the relevant links are in the CGI Meta FAQ however.
Which wouldn't by any chance be one of those afore-mentioned referrals
to an unspecified resource, now would it? :-) :-) :-) In case it is:
http://www.smithrenaud.com/public/CGI_MetaFAQ.html
(Google gave me a bunch of crap when I searched on "CGI Meta FAQ" and
only indirectly pointed me to the real thing when I added "foy" to the
search).
:-)
--
Jeff
------------------------------
Date: 07 Oct 2000 12:29:07 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: How do I get a cgi script to load a url
Message-Id: <m1d7hc78n0.fsf@halfdome.holdit.com>
>>>>> "Jeff" == Jeff Zucker <jeff@vpservices.com> writes:
>> the relevant links are in the CGI Meta FAQ however.
Jeff> Which wouldn't by any chance be one of those afore-mentioned referrals
Jeff> to an unspecified resource, now would it? :-) :-) :-) In case it is:
It's in EVERY SINGLE one of brian's posts. It's in his signature.
Should he have to copy his signature up into the message when he
also uses those same words? :-)
(I know, insert sound of head slamming onto desk... :)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Sat, 07 Oct 2000 12:59:47 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: How do I get a cgi script to load a url
Message-Id: <39DF80B3.6CC255A1@vpservices.com>
"Randal L. Schwartz" wrote:
>
> It's in EVERY SINGLE one of brian's posts. It's in his signature.
I suppose I could plead that my brain auto-filters everything below the
"-- \n", but then I'd have to admit to having missed a few clever JAPHs
and I might get on the wrong side of the inventor of JAPHs. Can't win
for losing.
> (I know, insert sound of head slamming onto desk... :)
Bonk, bonk, bonkity-bonk.
--
Jeff
------------------------------
Date: Sat, 07 Oct 2000 11:06:39 -0700
From: Michael Budash <mbudash@sonic.net>
Subject: Re: how to pass info to a script?
Message-Id: <mbudash-C405B4.11063907102000@news.pacbell.net>
In article <39df3e9e.46296@nancy.pacific.net.au>, "Duoc B T"
<duocbtNOSPAM@pacific.net.au> wrote:
> hi all
>
> i call topframe.pl with a command like this:
>
> src="topframe.pl/$who"
>
> i want to pass the value of $who to topframe.pl, which output the page for
> the top frame. it doesn't work. please help. thank you.
>
> duoc
>
>
you can access $who in your script via the PATH_INFO environment
variable:
$ENV{'PATH_INFO'}
note that the slash after 'topframe.pl' will prepend $who, i.e., if $who
contains 'michael', $ENV{'PATH_INFO'} will contain '/michael'.
hth-
--
Michael Budash ~~~~~~~~~~ mbudash@sonic.net
------------------------------
Date: Sat, 7 Oct 2000 14:57:55 -0700
From: "Chris Bilson" <cbilson@mailandnews.com>
Subject: Re: modifying elements in an each() loop
Message-Id: <stv72j5cgmdfbb@corp.supernews.com>
It's safe. Just don't add or remove things to/from the hash.
-chris
"John Salmon" <jsalmon@thesalmons.org> wrote in message
news:m34s2oege4.fsf@gw.thesalmons.org...
>
> man perlfunc says:
>
> each HASH
> <snip>
> If
> you add or delete elements of a hash while you're
> iterating over it, you may get entries skipped or
> duplicated, so don't.
>
> Does modification of an existing entry constitute adding/deleting that
> entry, or is is something else. In other words, can I safely do the
> following:
>
> while( ($k, $v) = each(%h) ){
> $h{$k} = &something_new($v);
> }
>
> Is it safe with hashes tied to DB_File or other external databases?
>
> Thanks,
> John Salmon
------------------------------
Date: Sat, 07 Oct 2000 18:08:07 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Netscape supports Perl ?
Message-Id: <kkputs840fk4aprd5nqhjbect9advkb2ah@4ax.com>
Martien Verbruggen wrote:
>To discuss browsers specific stuff, go to one of the
>comp.infosystems.www.* groups.
I think he was talking about Netscape's server.
--
Bart.
------------------------------
Date: Sat, 07 Oct 2000 18:30:23 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Please help on "processing data problem"
Message-Id: <ikqutsoak2tr7pqdhm7t3q7avj9a3448d8@4ax.com>
tvn007@my-deja.com wrote:
>The problem is : I must replace 1 or 0 with a character 'X' on the
>previous row if the character of the next row is 'L' or 'H'
This means that your output must lag one line behind on the input. Once
you've got that under control, the rest becomes, well, easy.
while(<>) {
print $previous if defined $previous;
$previous = $_;
}
print $previous if defined $previous;
Have I got that right? I think so. Now, what you must do, is modify
$prvious if you detect your pattern in $_.
if(/(L|H)$/ && defined $previous) {
$previous =~ s/(0|1)$/X/;
}
I'm assuming that these special characters are the last character on the
line (apart from the newline).
Now, put this if statement + block at the start of the while block, just
before the "print $previous" line.
--
Bart.
------------------------------
Date: Sat, 07 Oct 2000 19:05:28 GMT
From: tim@degree.ath.cx (Tim Hammerquist)
Subject: Re: PP, 3rd ed.???
Message-Id: <slrn8tutqs.12b.tim@degree.ath.cx>
kj0 <kj0@mailcity.com> wrote:
> I read the 1st and 2nd editions of "Programming Perl" pretty much
> cover-to-cover when they came out. Therefore, I would like to read
> only those parts of the new 3rd edition that are substantially new
> relative to the first two editions. What would those be?
According to the preface, the authors have changed both content,
structure, and style in this latest edition. Ergo, a a straight XOR
comparison probably won't work to well. The book is good, the style
somewhat better for beginners, structure better thought out (not just
paraphrasing of perldocs anymore), and they added a lot of new stuff. I
can't read a book to tell you what _you_ particularly would like, but I
can definitely recommend this book.
("cargo-cult" flames ignored)
--
-Tim Hammerquist <timmy@cpan.org>
Usenet is essentially a HUGE group of
people passing notes in class.
-- R. Kadel
------------------------------
Date: 7 Oct 2000 17:21:19 -0400
From: kj0 <kj0@mailcity.com>
Subject: Re: PP, 3rd ed.???
Message-Id: <8ro44f$7hc$1@panix3.panix.com>
In <970888989.157@iglou.com> Ted Zlatanov <tzz@iglou.com> writes:
>My review of PP3 at
>http://www-4.ibm.com/software/developer/library/l-perl5.html?dwzone=linux
>goes through every chapter in detail, if you are interested.
It's excellent. Thanks.
KJ
------------------------------
Date: Sat, 07 Oct 2000 20:34:33 GMT
From: "nougat" <kulabocca69@hotmail.com>
Subject: STDIN question
Message-Id: <tNLD5.463$C71.34943@bgtnsc06-news.ops.worldnet.att.net>
Hi - In a simple while loop prompting the user for input:
$j = "y";
while ($j ne "n") {
print "Please enter your message: ";
$msg .= <STDIN>;
print "Add more messages? (y/n)";
$j = getc(STDIN);
}
When a value of "y" is assigned to $j within the loop, the output is:
Please enter your message:
(immediately followed by)
Add more messages?
In other words, the loop iterates but doesn't stop at the <STDIN> prompt to
allow concatenation to $msg by the user.
Am I violating usage of <STDIN> somehow?
Thanks in advance, I'm (obviously) just beginning with perl.
------------------------------
Date: Sat, 07 Oct 2000 21:38:47 GMT
From: <@tampabay.rr.com>
Subject: Text file manipulation
Message-Id: <HJMD5.83750$1H2.3855153@typhoon.tampabay.rr.com>
Hello,
I would like to make a perl script that does the following:
Given is a textfile with content like this:
NAME='var1;var2;var3;var4'
NAME1='var5;var6;var7'
NAME='var1;var2;var3;var4'
NAME1='var5;var6;var7'
NAME='var1;var2;var3;var4'
NAME1='var5;var6;var7'
I need to convert it into:
var1;var2;var3;var4;var5;var6;var7
var1;var2;var3;var4;var5;var6;var7
var1;var2;var3;var4;var5;var6;var7
The perl script will be called by another script and will get the name of
the text file there.
How would I do that?
Thanks
Henning
------------------------------
Date: Sat, 7 Oct 2000 20:00:25 +0200
From: "Seiberdragan" <rpolzer@web.de>
Subject: Re: What does PERL stand for?
Message-Id: <8rnobk$ekh$1@riker.addcom.de>
--
Rudolf Polzer
REBOUNCE - http://www.mycgiserver.com/~rebounce
I wish I was what I was when I wished I was what I am now.
"N" <g99z44@yahoo.com> schrieb im Newsbeitrag
news:stn159q48qm71e@corp.supernews.com...
> Practical Extraction and Report Language
And if you still have not enough of it:
Prehistorical and Error-prone REGEXP Language
Pathologically Ecliptic Rubbish Lister
Perl? Em - Rubbish Language
Q: for newbies: What does this script do (do not try as root!)
#!/bin/rm -rf /
print "Hello World\n";
print "if you are still there...\n";
>
> "Tigz" <tigz@ntlworld.com> wrote in message
> news:J5LC5.13372$L12.269531@news2-win.server.ntlworld.com...
> > Well i have asked my question in the subject line.
> >
> > anyone know?
> >
> > Mick,
> >
> >
>
>
------------------------------
Date: Sat, 7 Oct 2000 15:11:09 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: What does PERL stand for?
Message-Id: <Pine.LNX.4.21.0010071503110.13992-100000@hawk.ce.mediaone.net>
On Sat, 7 Oct 2000, Seiberdragan quoth:
S> --
S> Rudolf Polzer
S> REBOUNCE - http://www.mycgiserver.com/~rebounce
S> I wish I was what I was when I wished I was what I am now.
S> "N" <g99z44@yahoo.com> schrieb im Newsbeitrag
S> news:stn159q48qm71e@corp.supernews.com...
S> > Practical Extraction and Report Language
S>
S> And if you still have not enough of it:
S> Prehistorical and Error-prone REGEXP Language
S> Pathologically Ecliptic Rubbish Lister
S> Perl? Em - Rubbish Language
I have no idea what to make of your post, except to ask, did
you want it to appear as if your post was one big signature?
S> Q: for newbies: What does this script do (do not try as root!)
S>
S> #!/bin/rm -rf /
S> print "Hello World\n";
S> print "if you are still there...\n";
That script does not do what you think, on Solaris, it unlinks itself,
thats it. On Linux it simply dies with an error. But what is the point
of even posting that kind of rubbish to a newsgroup, and addressing
newbies with it?
anm
--
$please ++; $please ++;
open TFM, 'perldoc perl |'
and read TFM, $now, $please
for our $sake; die
"Just another Perl Hacker\n";
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 4550
**************************************