[9301] in Perl-Users-Digest
Perl-Users Digest, Issue: 2896 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 18 00:08:25 1998
Date: Wed, 17 Jun 98 21:00:26 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 17 Jun 1998 Volume: 8 Number: 2896
Today's topics:
Re: $a: numeric or NOT ? (Ronald J Kimball)
Re: Array Combinations Question (Martien Verbruggen)
Re: Excel - Perl conversion (Bob Trieger)
Re: Excel - Perl conversion (Martien Verbruggen)
first language <fkunkel@cp.duluth.mn.us>
Re: getting first letter of a string (Ronald J Kimball)
Re: Help with comparing/pattern matching (Abigail)
Re: Help with comparing/pattern matching (Patrick Timmins)
Re: I need help with my ^M problem. (Bobby Chan)
Perl CGI forms <p-lanphier@psu.edu>
Re: Perlscript Problem (Patrick Timmins)
Re: Please HELP convert a SIMPLE 2 Line DOS Batch File! (Ilya Zakharevich)
Re: Problems with newlines in perl regexp (Patrick Timmins)
Re: Puzzle challenge (clarified) (Ronald J Kimball)
Re: Q: grep/map and regex recompilation <uri@sysarch.com>
Re: Q: grep/map and regex recompilation (Ronald J Kimball)
Re: Q: grep/map and regex recompilation (Mark-Jason Dominus)
Re: Q: how to set regex options on the fly (Abigail)
Re: REVIEW: Perl CGI Programming - No Experience Requir (Ronald J Kimball)
Re: REVIEW: Perl CGI Programming - No Experience Requir (Rahul Dhesi)
Re: SMTP blocking detection script comments requested. (Abigail)
Re: Vote today, read CFV for c.l.p.moderated, Post the (Allen Scott-Thoennes)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 17 Jun 1998 23:14:19 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: $a: numeric or NOT ?
Message-Id: <1dasg3d.127knwz1715swmN@bay1-374.quincy.ziplink.net>
Abigail <abigail@fnx.com> wrote:
> Ronald J Kimball (rjk@coos.dartmouth.edu) wrote on MDCCLI September
> MCMXCIII in <URL: news:1daqr6b.nz8r3xglbmtuN@bay1-114.quincy.ziplink.net>:
>
> ++ It's in Programming Perl, but not the standard documentation. :-(
>
> Well, it's there, but Tom's method of using 'grep' fails this time.
> Unless you know what the grep for :)
>
> From perldata.pod:
>
> =head2 Scalar value constructors
>
> Numeric literals are specified in any of the customary floating point or
> integer formats:
>
> [...]
> 4_294_967_296 # underline for legibility
>
> Underscores are called "underline" here....
Actually, I noticed that. I did think it was odd that it was called
"underline" instead of "underscore".
Nevertheless, this does not say that underscores are allowed *only* in
numeric literals. That fact is not found anywhere in the standard
documentation.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 18 Jun 1998 02:18:09 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Array Combinations Question
Message-Id: <6m9td1$j2e$1@comdyn.comdyn.com.au>
In article <6m8mve$h2h$1@nnrp1.dejanews.com>,
zucker@my-dejanews.com writes:
> Hello,
>
> how can I get all of the combinations of a dynamic multidiminsional array?
>
> for example:
[snip]
The ordering of your data is a bit unlucky, but this is a way:
#!/usr/local/bin/perl -w
use strict;
my @array;
$array[0][0] = "hello";
$array[0][1] = "there";
$array[1][0] = "jupiter";
$array[1][1] = "saturn";
$array[1][2] = "mars";
$array[2][0] = "happy";
# for each first word
for my $i (0..$#{$array[0]})
{
# for each second word
for my $j (0..$#{$array[1]})
{
# for each third word
for my $k (0..$#{$array[2]})
{
print join( ' ',
$array[0][$i],
$array[1][$j],
$array[2][$k],
), "\n";
}
}
}
If you need it more general, e.g the number of words in a sentence is
not always the same it gets a lot harder. You might need some
recursive algorithm, or even better you use a different way of storing
your data.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | In the fight between you and the world,
Commercial Dynamics Pty. Ltd. | back the world - Franz Kafka
NSW, Australia |
------------------------------
Date: Thu, 18 Jun 1998 02:04:49 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Excel - Perl conversion
Message-Id: <6m9snd$7c3$1@strato.ultra.net>
[ posted and mailed ]
Juli@my-dejanews.com wrote:
-> I am looking for a script that will convert excel into perl.
-> Any idea if a script like this exists? and where I could possibily obtain
-> it?
Convert excel into perl?
Do you mean access an excel spreadsheet using perl? If so, you are looking for
the Win32::OLE.
HTH
Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-239-0341
and hang up when the recording starts. "
------------------------------
Date: 18 Jun 1998 02:25:35 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Excel - Perl conversion
Message-Id: <6m9tqv$j2e$2@comdyn.comdyn.com.au>
In article <6m9lob$48m$1@nnrp1.dejanews.com>,
Juli@my-dejanews.com writes:
> I am looking for a script that will convert excel into perl.
Euhm.. How do you imagine that? Excel is a spreadsheet program, and
Perl is a programming language. It's like asking for a tire that will
convert your chair into a banana.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | Very funny Scotty, now beam down my
Commercial Dynamics Pty. Ltd. | clothes.
NSW, Australia |
------------------------------
Date: Wed, 17 Jun 1998 21:04:33 -0500
From: Fred Kunkel <fkunkel@cp.duluth.mn.us>
Subject: first language
Message-Id: <358875B1.398B@cp.duluth.mn.us>
Is perl a good language for the non-programer to attempt learning a cgi
programing language? Is there a logical aproach to learning perl or
should one start with some other language that might be easier to
understand?
------------------------------
Date: Wed, 17 Jun 1998 23:14:21 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: getting first letter of a string
Message-Id: <1dasgi4.7jn3vv674byeN@bay1-374.quincy.ziplink.net>
Michael J Gebis <gebis@albrecht.ecn.purdue.edu> wrote:
> rjk@coos.dartmouth.edu (Ronald J Kimball) writes:
>
> }($first) = $string =~ /([a-z])/i;
>
> };-)
>
> You fascist american umlaut-ignoring, accent-hating, not-to-mention
> that-funny-german-B-and-that-french-c-with-a-tail-bigoted pig!
($first) = $string =~ /([^\W\d_])/i;
;-)
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 18 Jun 1998 01:25:05 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Help with comparing/pattern matching
Message-Id: <6m9q9h$dcu$1@client3.news.psi.net>
julih@earthlink.net (julih@earthlink.net) wrote on MDCCLI September
MCMXCIII in <URL: news:6m9ec1$ohg$1@nnrp1.dejanews.com>:
++ unless (open(LIST, "list.pl")) {
++ die ("Can't open list\n");
++ }
++ $rep_name = "RIA";
++ while (<LIST>) {
++ if ($_ =~ "$rep_name") {
++ substr($_,3) =~ tr/a-z/A-Z/;
++ print "Rep name found keep in caps $_\n"; exit;
++ }
++ else{
++ substr($rep_name,0) =~ tr/a-z/A-Z/;
++ substr($rep_name,1) =~ tr/A-Z/a-z/;
++ print "Rep name not found keep capitalize $rep_name\n";
++ exit;
++ }
++ }
++ What I'm doing is comparing a name against a file,
++ if the name exists in the file, keep it in caps,
++ else, take the name and capitalize the first letter.
++ When I use =~ in the If statement name is capitalized.
++ When I use = in the If statement the entire name is capitalized.
++ This is the only way I can get them to work separately, but not together.
++ Any help is appreciated - julih@earthlink.net
Your code doesn't match what you describe you want to do.
First of all, you say you look if the name appears in the file,
and do different things depending whether it's there or not.
However, you do different things for each line; not for the
entire file.
Secondly, you say only want to change the capitalization of the
name, yet if the name appears on a line, you change the capitalization
of the entire line (except for the first 3 chars - beats me why).
Thirdly, the use of tr/a-z/A-Z/ doesn't take locale into aspect.
Use lc, uc, ucfirst and lcfirst instead.
Assuming your description of what you want to do is correct (if you
can't describe would you want, you shouldn't be posting), you might
want to use something like:
use locale;
use strict;
local *FILE;
open FILE, "list.pl" or die "Cannot open file: $!";
my $text;
{local $/; $text = <FILE>;}
close FILE or die "Cannot close file: $!";
my $rep_name = 'RIA';
$rep_name = ucfirst lc $rep_name if $text =~ /$repname/;
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET", "http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content)) =~ /(.*\))[-\s]+Addition/s) [0]'
------------------------------
Date: Thu, 18 Jun 1998 01:26:29 GMT
From: ptimmins@netserv.unmc.edu (Patrick Timmins)
Subject: Re: Help with comparing/pattern matching
Message-Id: <6m9qc5$al0$1@nnrp1.dejanews.com>
In article <6m9ec1$ohg$1@nnrp1.dejanews.com>,
julih@earthlink.net wrote:
>
> unless (open(LIST, "list.pl")) {
> die ("Can't open list\n");
> }
> $rep_name = "RIA";
> while (<LIST>) {
> if ($_ =~ "$rep_name") {
> substr($_,3) =~ tr/a-z/A-Z/;
> print "Rep name found keep in caps $_\n"; exit;
> }
> else{
> substr($rep_name,0) =~ tr/a-z/A-Z/;
> substr($rep_name,1) =~ tr/A-Z/a-z/;
> print "Rep name not found keep capitalize $rep_name\n";
> exit;
> }
> }
> What I'm doing is comparing a name against a file,
> if the name exists in the file, keep it in caps,
> else, take the name and capitalize the first letter.
> When I use =~ in the If statement name is capitalized.
> When I use = in the If statement the entire name is capitalized.
> This is the only way I can get them to work separately, but not together.
> Any help is appreciated - julih@earthlink.net
>
I'm not sure that I follow you, and I don't understand the unless deal (why
not just open or die?), but here goes anyway. I'm assuming from the way that
you phrased your question that the name you are searching for is always
capitalized. If this name cannot be found in the file in question, then
convert it so that just the first letter is capitalized. If this is what you
want, then what I would do is:
$rep_name = "PATRICK";
$found_ref = 0;
open(LIST, "list.pl") || die "Can't open list\n";
while (<LIST>) {
if (/\b$rep_name\b/) {
print "Rep name found, keep in caps: $rep_name\n";
$found_ref = 1;
}
}
unless ($found_ref == 1) {
$first_letter = substr($rep_name,0,1);
$the_rest = substr($rep_name,1);
$first_letter =~ tr/a-z/A-Z/;
$the_rest =~ tr/A-Z/a-z/;
$rep_name = $first_letter.$the_rest;
print "Rep name not found, capitalize first letter $rep_name\n";
}
Hope this is what you were trying to do, or at least gets you started.
Patrick Timmins
U. Nebraska Medical Center
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 18 Jun 1998 01:38:36 GMT
From: kwb_cha@alcor.concordia.ca (Bobby Chan)
Subject: Re: I need help with my ^M problem.
Message-Id: <6m9r2s$9i6$1@newsflash.concordia.ca>
Hi All...
Thank you all for the tremendous help with my ^M problem. I need
to specially thank Bob Trieger and Ted McClellan for giving me a correct
way of dealing with this problem. Bob suggested using s/\cM//g and Ted
suggested using tr/\r//d. Both ways worked perfectly!
--
* Bobby Chan ICQ# 6847801 *
* kwb_cha@alcor.concordia.ca ___ __o "Put some excitement *
* bobby_chan1@hotmail.com --- -\<. between your legs... *
* Montreal, Quebec, CANADA ((( (_)/(_) Ride a Mountain Bike!" *
------------------------------
Date: Wed, 17 Jun 1998 22:59:44 -0400
From: "Patrick Lanphier" <p-lanphier@psu.edu>
Subject: Perl CGI forms
Message-Id: <6m9vq4$109k@r02n01.cac.psu.edu>
Keywords: Perl CGI forms
The below script I thought would load a predifined page if no parameters of
the following categories (listed in the script) were passed by a form which
it does but when the form is filled out and submitted to the script again
none of the parameters seem to be being passed hence it displays the same
form again instead of validating the data and displaying a success form or
an error form were corrections need to be made. Thank you in advance for
your help.
Patrick Lanphier
Applied Research Laboratory
----------------------------------------------------------------------------
--------------------
----------------------------------------------------------------------------
--------------------
#!D:\Perl\perl5\bin\perl
use CGI qw(:all);
$mail_prog = '/usr/lib/sendmail' ;
$message = "" ;
$found_err = "" ;
print "Content-type: text/html\n\n";
print "<html>\n" ;
print "\n" ;
print "<head>\n" ;
print "<title>New Page 1</title>\n" ;
print "</head>\n" ;
#Net::FTP(also available from CPAN)
$contact = param("contact") ;
$company = param("company") ;
$userid = param("userid") ;
$password = param("password") ;
$vpassword = param("vpassword") ;
$telephone = param("telephone") ;
$email = param("'email") ;
if (($contact eq "")
and ($company eq "")
and ($userid eq "")
and ($password eq "")
and ($vpassword eq "")
and ($telephone eq "")
and ($email !~
\@.+\..+/)){
print "\n" ;
print "<body>\n" ;
print "\n" ;
print '<p><big><big><font face="arial, helvetica">Electronic File Transfer - FTP Transfer</font></big></big></p>'."\n" ;
print "\n" ;
print "<p>For all incoming and outgoing file transfers from this server all below fields are\n" ;
print "required. The email address needs to be correct for this is how you will receive\n" ;
print "your password for login.</p>\n" ;
print "\n" ;
print '<form method="POST" action="ftpval.pl">'."\n" ;
print ' <table border="1" width="600">'."\n" ;
print " <tr>\n" ;
print ' <td width="150" align="right">Contact Na
me:</td>'."\n" ;
print ' <td width="180" align="CENTER"><input type="Text"
name="contact" size="20"></td>'."\n" ;
print ' <td width="270"> </td>'."\n" ;
print " </tr>\n" ;
print " <tr>\n" ;
print ' <td width="150" align="right">Company Name:</td>'."\n" ;
print ' <td width="180" align="CENTER"><input type="Text"
name="company" size="20"></td>'."\n" ;
print ' <td width="270"> </td>'."\n" ;
print " </tr>\n" ;
print " <tr>\n" ;
print ' <td width="150" align="right">Userid:</td>'."\n" ;
print ' <td width="180" align="CENTER"><input type="Text" name="userid"
size="20" maxlength="8"></td>'."\n" ;
print ' <td width="270"> </td>'."\n" ;
print " </tr>\n" ;
print " <tr>\n" ;
print ' <td width="150" align="right">Password</td>'."\n" ;
print ' <td width="180" align="CENTER"><input type="Password"
name="password" size="20" maxlength="8"></td>'."\n" ;
print ' <td width="270"> </td>'."\n" ;
print " </tr>\n" ;
print " <tr>\n" ;
print ' <td width="150" align="right">Confirm Password:</td>'."\n" ;
print ' <td width="180" align="CENTER"><input type="Password"
name="vpassword" size="20" maxlength="8"></td>'."\n" ;
print ' <td width="270"> </td>'."\n" ;
print " </tr>\n" ;
print " <tr>\n" ;
print ' <td width="150" align="right">Telephone Number:</td>'."\n" ;
print ' <td width="180" align="CENTER"><input type="Text"
name="telephone" size="20"></td>'."\n" ;
print ' <td width="270"> </td>'."\n" ;
print " </tr>\n" ;
print " <tr>\n" ;
print ' <td width="150" align="right">Email Address:</td>'."\n" ;
print ' <td width="180" align="CENTER"><input type="Text" name="email"
size="20"></td>'."\n" ;
print ' <td width="270"> </td>'."\n" ;
print " </tr>\n" ;
print " <tr>\n" ;
print ' <td width="150" align="right">Verify Password:</td>'."\n" ;
print ' <td width="180" align="CENTER"><input type="text" name="T1"
size="20"></td>'."\n" ;
print ' <td width="270"> </td>'."\n" ;
print " </tr>\n" ;
print " </table>\n" ;
print ' <p><input type="submit" value="Submit"><input type="reset"
value="Reset"'."\n" ;
print ' name="B2"></p>'."\n" ;
print "</form>\n" ;
print "</body>\n" ;
print "</html>\n" ;
}
else
{
if ($contact eq "") {
$contact_err = "<p>Field 'contact' must be filled in.</p>\n" ;
$found_err = 1 ;
}else{
$contact_err = ' ';
}
if ($company eq "") {
$company_err = "<p>Field 'company' must be filled in.</p>\n" ;
$found_err = 1 ;
}else{
$company_err = ' ';
}
if ($userid eq "") {
$userid_err = "<p>Field 'userid' must be filled in.</p>\n" ;
$found_err = 1 ;
}else{
$userid_err = ' ';
}
if ($password eq "") {
$password_err = "<p>Field 'password' must be filled in.</p>\n" ;
$found_err = 1 ;
}elsif(length($password) < 5){
$password_err = "<p>'Password' length must be more than 5
characters.</p>\n" ;
$found_err = 1 ; }
else{
$password_err = ' ';
}
if ($vpassword eq "") {
$vpassword_err = "<p>The password you entered is not valid.</p>\n" ;
$found_err = 1 ;
}elsif($password ne $vpassword){
$vpassword_err = "<p>The confirmed password does not match</p>\n" ;
$found_err = 1 ;}
else{
$vpassword_err = ' ';
}
if ($telephone eq "") {
$telephone_err = "<p>Field 'telephone' must be filled in.</p>\n" ;
$found_err = 1 ;
}elsif(length($telephone)< 8){
$telephone_err = "<p>Invalid Format.</p>\n" ;
$found_err = 1 ;
}else{
$telephone_err = ' ';
}
if ($email !~ /.+\@.+\..+/) {
$email_err = "<p>Please enter a valid email address</p>\n" ;
$found_err = 1 ;
}else{
$email_err = ' ';
}
if($found_err == 1){
print "\n" ;
print "<body>\n" ;
print "\n" ;
print '<p><big><big><font face="arial, helvetica">Electronic File Transfer -
FTP Transfer</font></big></big></p>'."\n" ;
print "\n" ;
print "<p>For all incoming and outgoing file transfers from this server all
below fields are\n" ;
print "required. The email address needs to be correct for this is how
you will receive\n" ;
print "your password for login.</p>\n" ;
print "\n" ;
print '<form method="POST" action="ftpval.pl">'."\n" ;
print ' <table border="1" width="600">'."\n" ;
print " <tr>\n" ;
print ' <td width="150" align="right">Contact Name:</td>'."\n" ;
print ' <td width="180" align="CENTER"><input type="Text"
name="contact" size="20" value ="' . $contact . '"></td>'."\n" ;
print ' <td width="270"><font color="Red">' . $contact_err .
'</font></td>'."\n" ;
print " </tr>\n" ;
print " <tr>\n" ;
print ' <td width="150" align="right">Company Name:</td>'."\n" ;
print ' <td width="180" align="CENTER"><input type="Text"
name="company" size="20" value ="' . $company . '"></td>'."\n" ;
print ' <td width="270"><font color="Red">' . $company_err .
'</font></td>'."\n" ;
print " </tr>\n" ;
print " <tr>\n" ;
print ' <td width="150" align="right">Userid:</td>'."\n" ;
print ' <td width="180" align="CENTER"><input type="Text" name="userid"
size="20" maxlength="8" value ="' . $userid . '"></td>'."\n" ;
print ' <td width="270"><font color="Red">' . $userid_err .
'</font></td>'."\n" ;
print " </tr>\n" ;
print " <tr>\n" ;
print ' <td width="150" align="right">Password</td>'."\n" ;
print ' <td width="180" align="CENTER"><input type="Password"
name="password" size="20" maxlength="8" value ="' . $password .
'"></td>'."\n" ;
print ' <td width="270"><font color="Red">' . $password_err .
'</font></td>'."\n" ;
print " </tr>\n" ;
print " <tr>\n" ;
print ' <td width="150" align="right">Confirm Password:</td>'."\n" ;
print ' <td width="180" align="CENTER"><input type="Password"
name="vpassword" size="20" maxlength="8" value ="' . $vpassword .
'"></td>'."\n" ;
print ' <td width="270"><font color="Red">' . $vpassword_err .
'</font></td>'."\n" ;
print " </tr>\n" ;
print " <tr>\n" ;
print ' <td width="150" align="right">Telephone Number:</td>'."\n" ;
print ' <td width="180" align="CENTER"><input type="Text"
name="telephone" size="20" value ="' . $telephone . '"></td>'."\n" ;
print ' <td width="270"><font color="Red">' . $telephone_err .
'</font></td>'."\n" ;
print " </tr>\n" ;
print " <tr>\n" ;
print ' <td width="150" align="right">Email Address:</td>'."\n" ;
print ' <td width="180" align="CENTER"><input type="Text" name="email"
size="20" value ="' . $email . '"></td>'."\n" ;
print ' <td width="270"><font color="Red">' . $email_err .
'</font></td>'."\n" ;
print " </tr>\n" ;
print " <tr>\n" ;
print ' <td width="150" align="right">Verify Password:</td>'."\n" ;
print ' <td width="180" align="CENTER"><input type="text" name="T1"
size="20" value ="' . $vpassword . '"></td>'."\n" ;
print ' <td width="270"><font color="Red">' . $vpassword_err
.'</font></td>'."\n" ;
print " </tr>\n" ;
print " </table>\n" ;
print ' <p><input type="submit" value="Submit" name="B1"><input
type="reset" value="Reset"'."\n" ;
print ' name="B2"></p>'."\n" ;
print "</form>\n" ;
print "</body>\n" ;
print "</html>\n" ;
}
else
{
print <<endofsection;
\n
<body>\n
Successfull\n
</body>\n
</html>\n
endofsection
}
}
------------------------------
Date: Thu, 18 Jun 1998 02:43:53 GMT
From: ptimmins@netserv.unmc.edu (Patrick Timmins)
Subject: Re: Perlscript Problem
Message-Id: <6m9ut9$gu9$1@nnrp1.dejanews.com>
In article <6m9asb$ct9$1@homer.bucknell.edu>,
"Skrub" <skrub@bigfoot.com> wrote:
>
> I know this is the Perl forum, but I couldn't find a perlscript newsgroup,
> so I hope osmeone here can help me.
>
> I need to use perlscript in an active server page to access files on the
> server. I know it can be done with vbscript, so I hope it can be done in
> perlscript. I really don't want to have to go and learn vbscript.
>
> If anyone knows how to do this, please e-mail me.
>
> Thank You,
>
> --
> Brian McCallister
> skrub@bigfoot.com
>
>
Really, I think you mean:
while (<YOUR_POST>) {
s/vbscript/vbscript, perlscript, or Perl/g;
print;
}
Isn't that right?
Patrick Timmins
U. Nebraska Medical Center
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 18 Jun 1998 02:03:18 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Please HELP convert a SIMPLE 2 Line DOS Batch File!!
Message-Id: <6m9sh6$5ol$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Larry Rosler
<lr@hpl.hp.com>],
who wrote in article <MPG.ff202e96f92f019989699@nntp.hpl.hp.com>:
> > > open OUT, ">$dir/$file" or die "even more gruesomely, $!";
> > > print OUT "This is some text\n";
> > > close OUT;
> >
> > You did not check errors on close(), so do not know whether your
> > print() succeeds.
> It might have been worse. I was tempted to omit the close() entirely and
> default it to wrap-up, but decided that was bad pedagogy :-)
>
> The conditions under which close() might fail are bizarre in any case.
> As this isn't a pipe, I'm not sure what they might be.
Disk full?
> If one wants to know whether print() succeeds, shouldn't one ask print()
> or die? But no one *ever* does that. I know print() can fail on a full
> file system, for example, but would that necessarily be reflected by a
> failure to close()?
print() is usually called in a loop, so it may be expensive to check it.
Thus people check close().
Ilya
------------------------------
Date: Thu, 18 Jun 1998 02:50:48 GMT
From: ptimmins@netserv.unmc.edu (Patrick Timmins)
Subject: Re: Problems with newlines in perl regexp
Message-Id: <6m9va8$hin$1@nnrp1.dejanews.com>
In article <eli$9806171426@qz.little-neck.ny.us>,
Eli the Bearded <*@qz.to> wrote:
[snip]
>
> Your code is a bit difficult to read, by the way.
>
> Elijah
> ------
> and found it worse so since he is not used to 'use English';
>
Me too. Isn't that strange? 'use English' slows everything down in my head.
Patrick Timmins
U. Nebraska Medical Center
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Wed, 17 Jun 1998 23:14:22 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Puzzle challenge (clarified)
Message-Id: <1dasgw2.lar2yr1ec9icrN@bay1-374.quincy.ziplink.net>
Sorry, didn't get Jeff's message on my news server, so I'll reply to
both here.
Martien Verbruggen <mgjv@comdyn.com.au> wrote:
> In article <6m8mtm$n1t@sjx-ixn10.ix.netcom.com>,
> jeff@yoak.com (Jeff Yoak) writes:
> > rjk@coos.dartmouth.edu (Ronald J Kimball) wrote:
> >>Daniel Grisinger <dgris@perrin.dimensional.com> wrote:
>
> [snip]
>
> >>> 2. Some messengers scrambled the order of the message, others forgot
> >>> parts of it. None did both, all did one.
> >> ^^^^^^^^^^^^^^^^^^^^^^^^^^^
> >
> >>That makes it rather easy.
> >>
> >>Find two messages with words in a different order. The longer one must
> >>contain all the words and be in the wrong order.
> >
> > Why couldn't one messenger forget two words and the other forget only
> > one?
The two messages have words in a different order. There is only one
correct order, so at least one of the messages has scrambled the other
of the message. According to Rule 2, every messenger *either* scrambled
the order, *or* forgot parts, *but not both*. Therefore, the message
which is out of order must contain all the words.
> I think that it depends on how you read that condition. You can
> interpret it as 'No messenger made both _types_ of mistake. All
> messengers made one type of mistake, but could make this mistake
> multiple times' (i.e. forget more than one word, or scramble the order
> three times). You could also read it as 'No messenger made both
> mistakes. All messengers made one mistake', which I think is what
> Ronald Kimball read it as. Of course that would be equivalent to
> saying: 'All messagers made one mistake exactly'.
No, I read it as the former. But it does not matter, as the logic holds
either way. A messenger cannot both scramble the order and drop a word.
Therefore any message which is missing words must be in the correct
order. If both messages were in the correct order, they would not have
been chosen by my algorithm, as I require in step one that the two
messages chosen contain words in a different order.
Here is another way of phrasing it, focusing on the message rather than
the messenger:
Each message will either be missing words, or be out of order, but not
both. Every message that is missing words is in the correct order, and
every message that is out of order contains all the words.
> >> All messages which
> >>contain the same number of words are also in the wrong order.
> >
> > I must be missing something. If two messengers each forgot n words,
> > why wouldn't they all be in the correct order?
My sentence should be read as "All messages which contain the same
number of words *as the scrambled message from above* are also in the
wrong order. Once again, every messenger either scrambled the order or
forgot parts of the message. If any messenger forgots n words, for n >
0, the message must be in the correct order, and any message containing
all the words must be in the wrong order.
> Again, this comes down to how you read that condition.
Actually, this comes down to how you read my sentence above, which was
ambiguous. I hope I clarified it sufficiently.
> That's why mathematicians, logicians and philosophers are always so
> annoyingly precise :)
Yup.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 17 Jun 1998 22:29:22 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Q: grep/map and regex recompilation
Message-Id: <x7u35je931.fsf@sysarch.com>
>>>>> "IZ" == Ilya Zakharevich <ilya@math.ohio-state.edu> writes:
well, i got some good feedback. i was aware of vars in the regex and
/o.
the new twist is that in grep/map the regex is checked for change and
then recompiled if it has. this is not clear in any docs that i know
about. can someone point me to the doc supporting this behaviour?
IZ> If RE contains variables:
IZ> b) Thus the value will be checked whether it changed, and if
IZ> not, the already compiled form will be used; c) Starting from
IZ> just-released 5.004_67, if it is /$regexp/, the comparison in b)
IZ> is skipped if $regexp was not modified.
also is this true outside map/grep? does a regex in a for/while loop
check if it has changed and then not recompile? my impression was that
it always compiled which is why the eval of regex code was used, to
reduce the compiling of dynamic regexes.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire ---- 8 Years of Perl Experience, Available Immediately
uri@sysarch.com --------- Resume and Perl Example at http://www.sysarch.com
Use the Best Search Engine on the Net -------- http://www.northernlight.com
------------------------------
Date: Wed, 17 Jun 1998 23:14:24 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Q: grep/map and regex recompilation
Message-Id: <1dasib5.1vyuqie17l2gywN@bay1-374.quincy.ziplink.net>
Uri Guttman <uri@sysarch.com> wrote:
> when you use a regex in the expression of a map or grep, does the regex
> get recompiled for each internal iteration? or does it keep the complete
> expression and compiled regex and just apply it to each $_ in the loop?
$re = 'm';
print grep {$re++; /$re/ } qw(foo Once Recompiled);
$re = 'm';
print grep {$re++; /$re/o} qw(foo Once Recompiled);
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 17 Jun 1998 23:54:09 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Q: grep/map and regex recompilation
Message-Id: <6ma311$6ps$1@monet.op.net>
In article <6m807m$3o2$1@mathserv.mps.ohio-state.edu>,
Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
> b) Thus the value will be checked whether it changed, and if not,
> the already compiled form will be used;
I was surprised by this. When did it come in?
------------------------------
Date: 18 Jun 1998 01:12:39 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Q: how to set regex options on the fly
Message-Id: <6m9pi7$ct5$2@client3.news.psi.net>
Matthew.Wickline@usa.net (Matthew.Wickline@usa.net) wrote on MDCCLI
September MCMXCIII in <URL: news:6m9acq$jan$1@nnrp1.dejanews.com>:
++
++ For the purposes of this message, we'll assume that the *only*
++ difference in these subroutines is the options used on a m//
++ operator burried within the anonymous subroutines. Depending on
++ the args given, there may be any/some/all of the imsx options.
++
++ Is there an easier way to do this than to code out some 2^4
++ anonymous subroutines and do an equivilant of a case?
Read perlre and look up '(?ismx)'.
Abigail
--
perl -wle 'print "Prime" if (0 x shift) !~ m 0^\0?$|^(\0\0+?)\1+$0'
------------------------------
Date: Wed, 17 Jun 1998 23:14:25 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: REVIEW: Perl CGI Programming - No Experience Required
Message-Id: <1dasiq9.x3yysqo6vjahN@bay1-374.quincy.ziplink.net>
Rahul Dhesi <c.c.eiftj@54.usenet.us.com> wrote:
> In <pudge-1706980805290001@dynamic464.ply.adelphia.net> pudge@pobox.com
> (Chris Nandor) writes:
>
> >Here it is, your definition, which was
> >already 100 percent inferrable from the above information:
>
> > an array is a variable. a list is not.
>
> >That simple. Go home now.
>
> I will buy that, if everybody else will agree with you.
>
> My next question is: If the only difference between the two is that one
> is in a single variable, and the other is explicitly enumerated, why are
> we making such a a big deal of this difference?
That's not the only difference between the two, you goof.
You asked for a simple definition. You got one. You then leapt to the
conclusion that the simple definition described the only difference
between the two, which is obviously not the case.
There have already been numerous examples posted in this very thread of
the differences between lists and arrays. To refresh your memory (which
appears to be so limited that you can't even recall a single post beyond
the one you are replying to at the moment), here is one of those
examples again:
@array = ('this', 'is', 'an', 'array');
pop @array;
pop ('this', 'is', 'just', 'a', 'list');
> We don't make a big
> deal of the fact that the interger held in $i is differnt from the
> integer explicitly denoted by 15. If the ONLY difference between two
> things is that one is in a variable and the other is not, that's hardly
> a difference worth arguing about.
$i++
15++
Once again, that is not the only difference between the two things.
That would be like defining men and women by saying men have a Y
chromosome and women don't, and then concluding that the only difference
between men and women is the chromosomes.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 18 Jun 1998 00:38:32 GMT
From: c.c.eiftj@54.usenet.us.com (Rahul Dhesi)
Subject: Re: REVIEW: Perl CGI Programming - No Experience Required
Message-Id: <6m9ni8$dut$1@samba.rahul.net>
In <6m8e79$6ga$1@csnews.cs.colorado.edu> Tom Christiansen
<tchrist@mox.perl.com> writes:
>Arrays have
>mutable lengths, but lists do not. That's because an AV has both a
>length field and a list in it. A list nodesn't have that length field
>separate from itself.
[ C code from within perl interpreter ]
>Contrast then the xpvav structure with the "list" contained in AvARRAY.
>Look how much more there is! An AV can know its size, its class, etc.
>It can also be magical. Lists are none of these things.
I have no doubt that you are 100% correct.
But this doesn't help at all! How can a programmer looking at some
lines of perl decide how they would be rpresented internally within the
perl interpreter?
--
Rahul Dhesi <dhesi@spams.r.us.com>
------------------------------
Date: 18 Jun 1998 01:10:27 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: SMTP blocking detection script comments requested.
Message-Id: <6m9pe3$ct5$1@client3.news.psi.net>
gk (5@mail.com) wrote on MDCCLI September MCMXCIII in
<URL: news:3587FE3A.58AD7889@mail.com>:
++
++ My hopes is to have this work 100% of the time, to prove whether or not
++ domain A is
++ blocking domain B.
Nope. All it proves that this attempt to send a mail is not blocked
directly. But a mail server is free to do what it wants. It can
block every uneven attempt, or refuse mail on Sundays, or whatever.
A mail exchanger might just be that. A mail exchanger. For all you
know, it will accept mail from your domain, hand it over to
dev.null.domain.com which then bounces it. Or just drops it, and
you'll never heard from it again.
The best thing to do is just not to spam.
Abigail
--
perl -weprint\<\<EOT\; -eJust -eanother -ePerl -eHacker -eEOT
------------------------------
Date: Sun, 14 Jun 1998 21:37:04 GMT
From: sthoenna@efn.org (Allen Scott-Thoennes)
Subject: Re: Vote today, read CFV for c.l.p.moderated, Post the CFV here today,
Message-Id: <AKEh1gzkgudU092yn@efn.org>
In article <6lopk3$9ae$1@csnews.cs.colorado.edu>,
Tom Christiansen <tchrist@mox.perl.com> wrote:
> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc, pudge@pobox.com (Chris Nandor) writes:
>:It is against the rules to repost the CFV, and the CFV was
>:already posted here anyway.
>
>True on both counts. Unfortunately, those of us who kill crossposts
>consequently missed it (like me).
Try never killing crossposts that include news.announce.newsgroups.
If an RFD or a CFV is crossposted to a group you follow it is almost
always worth at least taking a look at.
------------------------------
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 2896
**************************************