[16261] in Perl-Users-Digest
Perl-Users Digest, Issue: 3673 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 14 18:15:43 2000
Date: Fri, 14 Jul 2000 15:15:31 -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: <963612931-v9-i3673@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 14 Jul 2000 Volume: 9 Number: 3673
Today's topics:
Re: Perl Expert? I need help! (Craig Berry)
Re: Perl Expert? I need help! (Craig Berry)
PERL IDES <rbank@csf.edu>
Re: Perl new users:about locat the string in file? (Eric Bohlman)
perl2exe worc99@my-deja.com
Perldoc, Redirect Output to File? WinNT <9jerry9@my-deja.com>
Re: Perldoc, Redirect Output to File? WinNT <lauren_smith13@hotmail.com>
Re: Perldoc, Redirect Output to File? WinNT <aqumsieh@hyperchip.com>
Re: PPM problems <greg2@surfaid.org>
Re: PRINTing " "" " <uri@sysarch.com>
Re: PRINTing " "" " <lr@hpl.hp.com>
Re: printing out list of checkboxes to a file. <care227@attglobal.net>
Q's about perl modules <cyan_01NOcySPAM@hotmail.com.invalid>
Re: Q's about perl modules <lauren_smith13@hotmail.com>
Re: Q's about perl modules <UlleAckermann@t-online.de>
Re: Qs for professional Perl/CGI developers (Nobody)
Re: Redirect External Program's output on Windows ? <bart.lateur@skynet.be>
Sending a Escape using Net::Telnet hamed53@my-deja.com
Sending an Escape using Net::Telnet hamed53@my-deja.com
Re: Silly Question? <juex@deja.com>
Re: Silly Question? <o1technospam@skyenet.nospam.net>
Re: String length? (Craig Berry)
Re: String length? <o1technospam@skyenet.nospam.net>
Re: String length? <o1technospam@skyenet.nospam.net>
Re: strings and symbol refs and strict - oh my! <aqumsieh@hyperchip.com>
Re: system question <panderse@us.ibm.com>
Re: The problem of two Submit buttons <lr@hpl.hp.com>
Trying to use an array as a hash value <rhys.tucker@dtn.ntl.com>
Re: Upper-to-lower case problem <bart.lateur@skynet.be>
Re: Upper-to-lower case problem <juex@deja.com>
Re: Use strict & subroutines <andrei@unforgettable.com>
Re: w32 module <carvdawg@patriot.net>
Re: Windmail/NT CGI script not sending mail <dwoods@ucalgary.ca>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 14 Jul 2000 21:26:05 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Perl Expert? I need help!
Message-Id: <smv1bd6gnd6161@corp.supernews.com>
Bernard El-Hagin (bernard.el-hagin@lido-tech.net) wrote:
: On Fri, 14 Jul 2000 13:02:42 GMT, Sylvain2k <sylvain2k@sympatico.ca> wrote:
: >$a = "My name is Sylvain";
: >
: >I want to delete ALL spaces in this variable.
: >I only want the first 8 caracters of the result.
:
: my $a = "My name is Sylvain";
: $a =~ s/\s+//g;
Since he asked specifically for spaces and not generic whitespace, doing
"tr/ //d" is both more efficient and closer to the spec.
: $a =~ s/^(.{8})/$1/;
Did you test that? It's what us oldbies like to call a "no-op". :)
--
| Craig Berry - http://www.cinenet.net/users/cberry/home.html
--*-- "Beauty and strength, leaping laughter and delicious
| languor, force and fire, are of us." - Liber AL II:20
------------------------------
Date: Fri, 14 Jul 2000 21:50:06 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Perl Expert? I need help!
Message-Id: <smv2oelhnd6135@corp.supernews.com>
Cal Henderson (cal@iamcal.com) wrote:
: "Bernard El-Hagin" <bernard.el-hagin@lido-tech.net> wrote...
: : $a =~ s/\s+//g;
: : $a =~ s/^(.{8}).*$/$1/;
:
: can this be done in a single reg ex?
That seems to be the question of the day, doesn't it? In this case, I
don't think so. You can't both transform away the spaces and count a set
of remaining characters in one operation, since the string used for
matching is unmodified for purposes of further comparison during the
global substitution.
If I'm allowed to use a simple loop plus a single regex, this does the
trick:
1 while $a =~ s/ +|(?<=.{8}).//;
--
| Craig Berry - http://www.cinenet.net/users/cberry/home.html
--*-- "Beauty and strength, leaping laughter and delicious
| languor, force and fire, are of us." - Liber AL II:20
------------------------------
Date: Fri, 14 Jul 2000 14:44:07 -0600
From: "Robin Bank" <rbank@csf.edu>
Subject: PERL IDES
Message-Id: <8knutk$116q$1@reader.nmix.net>
Anyone know any good PERL IDEs for Win98, I'm sick of notepad, and I need to
be able to rapidly develop perl.
Thanks,
Robin
------------------------------
Date: 14 Jul 2000 21:40:44 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Perl new users:about locat the string in file?
Message-Id: <8ko1cs$ui6$1@slb3.atl.mindspring.net>
[defunct comp.lang.perl removed from followups]
Tom (chaptera@hotmail.com) wrote:
: My current situation is, I want to find a string from a file.
:
: currently, I am using the script like this:
: .....
: open(file,"content.txt") or die "cannnot open";
Include $! in your diagnostic message so you can tell *why* the file
couldn't be opened.
: while(<file>)
: {
: if ($_ =~ /patten/)
The regex match operator works on $_ by default, so you could write this
as just "if (/pattern/)".
: {
: print "current line is " $. .......;
: last;
: }
: }
: close(file);
:
: the file content like this:
: AAAAAAA,BBBBBBBB,CCCCCCc
: 1111111111,DDDDDDDDDDDD,%%%%%%%%%%%
: .........
:
: Do you have any method faster than that?
: I mean that easy to locate the position and find the string.
: As of my file is greater than 3000 lines.
That's about as fast as you're going to get in the general case of matching
arbitrary patterns. If you know in advance that only a limited set of
patterns are going to be searched for, and the file's contents change
only infrequently, you can build an index of all the lines in the file
that match those particular patterns. But 3000 lines isn't really that
big a file. Have you actually timed your code, being careful not to
count Perl's startup time (using the Benchmark modules is a good way to
do this)?
------------------------------
Date: Fri, 14 Jul 2000 19:50:55 GMT
From: worc99@my-deja.com
Subject: perl2exe
Message-Id: <8knqun$t69$1@nnrp1.deja.com>
Hello,
I am attempting to use perl2exe and it works wonderful except when I
use libraries of a different version of perl. I cannot rebuild and
install these libraries in the instlation of perl that comes with
perl2exe because i don't hava access to the source. is there any way
for me to make use of these libraries with perl2exe? i attempted to
changethe libraries perl2exe uses by running a script they supplied for
that purpose, but it checks versions. i removed the version check, and
everything seems to go well. perl2exe is using the correct libraries
now, but i still get runtime errors? This is for perl2exe for SunOS.
Any ideas?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 14 Jul 2000 19:46:49 GMT
From: Jerry Leventer <9jerry9@my-deja.com>
Subject: Perldoc, Redirect Output to File? WinNT
Message-Id: <8knqn3$srf$1@nnrp1.deja.com>
I am running perl v5.6.0, bld 615 on WinNT4.0.
I would like to redirect the perldoc output to a file so I can print it
out or view it in a text editor such as 'vi'.
Is there a way to do this? I tried,
perldoc perldoc > file
The suggestion I saw, was to view them online or in the HTML format.
This would seem to defeat the value of something like,
perldoc -q faq_string
Thank you,
Jerry
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 14 Jul 2000 13:24:58 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: Perldoc, Redirect Output to File? WinNT
Message-Id: <8knt0b$1tm$1@brokaw.wa.com>
Jerry Leventer <9jerry9@my-deja.com> wrote in message
news:8knqn3$srf$1@nnrp1.deja.com...
> I am running perl v5.6.0, bld 615 on WinNT4.0.
>
> I would like to redirect the perldoc output to a file so I can print it
> out or view it in a text editor such as 'vi'.
> Is there a way to do this? I tried,
>
> perldoc perldoc > file
I just tried that and it worked. Did it not work for you?
> The suggestion I saw, was to view them online or in the HTML format.
> This would seem to defeat the value of something like,
>
> perldoc -q faq_string
If you wish to just read the FAQs (and other documentation) then they are
available in HTML as part of the ActiveState package. This doesn't
necessarily give you any searching capabilities above your browser's Search
command, but it may give you a better environment to read the docs in
(although you enjoy reading docs in vi, it seems). Also, reading the docs
on the web at www.perl.com allows you to conduct searches using the search
engine provided.
Maybe you could take a look at TomC's docgrep (is that right?) that he gives
the listing for in the Perl CookBook. It may also be available at
www.perl.com, but I don't guarantee that.
Lauren
------------------------------
Date: Fri, 14 Jul 2000 20:44:10 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: Perldoc, Redirect Output to File? WinNT
Message-Id: <7a3dlcjvc2.fsf@merlin.hyperchip.com>
"Lauren Smith" <lauren_smith13@hotmail.com> writes:
> Jerry Leventer <9jerry9@my-deja.com> wrote in message
> news:8knqn3$srf$1@nnrp1.deja.com...
> > I am running perl v5.6.0, bld 615 on WinNT4.0.
> >
> > I would like to redirect the perldoc output to a file so I can print it
> > out or view it in a text editor such as 'vi'.
> > Is there a way to do this? I tried,
> >
> > perldoc perldoc > file
>
> I just tried that and it worked. Did it not work for you?
You can also use pod2text which is part of the standard Perl
distribution.
--Ala
------------------------------
Date: Fri, 14 Jul 2000 20:24:14 +0100
From: Greg Griffiths <greg2@surfaid.org>
To: =?iso-8859-1?Q?K=E5re?= Olai Lindbach <barbr-en@online.no>
Subject: Re: PPM problems
Message-Id: <396F68DE.15C424BA@surfaid.org>
No I did revert back to the 509 build as I know it works, I did run the AP 513
install from the C:\perl directory. I'm not that bothered as I've got back what
I needed/had working (namely the DBI and web stuff) but I'm upset that I've lost
a lot of files en route, looking on the Activestate bugs page I see a few other
users with the same issue.
"Kåre Olai Lindbach" wrote:
> Greg Griffiths <greg2@surfaid.org> skrev i
> meldingsnyheter:396B79CA.329AEF73@surfaid.org...
> > As far as I could tell on a clean win98 build you just needed to instlal
> the MS
> > Installer and then AP 613 and then the PPM hotfix.
>
> Sorry, I almost give up. Maybe no good comfort for you telling you that my
> installation went right the first time.
> I also refer to the AP 613.
> Did you run the PPM hotfix.bat in the right perl\bin-catalog?
> Look into the bat-file and see what it does.
>
> > have reinstalled twice with 519 and failed, each time using a clean Win98
> build
> > (no extras, just Win and Office), reverted back to AP 509 and have no
> problems -
> > except the data and time I've lost to get back to where I was before I
> started.
>
> You still meen AP613, not 519, I guess. I do know about the feeling you have
> about loosing time and data.
>
> Maybe you should look into the newest release AP615. I have just installed
> it into a separate catalog:
> "d:\perl615" on my win98 machine. I still have AP613 in my "d:\perl".
> AP 615 installation info state that it should *not be installed* on top of a
> AP 5xx build-version. My AP613 are, though!
> AP522 still shows in Add/Remove programs, and resided in "d:\perl" when I
> installed.
>
> But AP615 need no ppmfix, only that your MS Installer are as new as in
> AP613. (It refers to the same version of InstMsi.exe).
>
> Well, I have tested my AP615, no problems using it to install other *.ppd
> using PPM. I always use MSDOS-shell and go to my perl-bin-cat (Ex:
> "d:\perl615\bin")
> before I run PPM.
>
> Still hoping for you to succeed!
>
> Regards,
>
> --
> mvh
> Kåre Olai Lindbach
> (LLP - 955626397 MVA)
> + 47 61282501(home/job)
> + 47 61282502(fax)
> barbr-en@online.no
------------------------------
Date: Fri, 14 Jul 2000 18:08:12 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: PRINTing " "" "
Message-Id: <x7k8eoinzn.fsf@home.sysarch.com>
>>>>> "JE" == Jürgen Exner <juex@deja.com> writes:
JE> I honestly do not understand why you object so strongly against using
JE> escaped quotes.
JE> Granted, it may look ugly and there are other ways to do it.
that is the reason. it is ugly. since perl has so many ways to handle
them, escaping them is the worst.
JE> - Escaped quotes are _the_ standard way in any script or programming
JE> language I know of (ranging from sh and VBS to Lips, Haskell, and C++).
so, program in them. and one issue with all of them is they have only
ONE way to escape quotes. so that doesn't mean you have to use that
method in perl.
JE> Therefore anyone who knows at least a little bit about programming
JE> is familiar with them already. On the other hand how many
JE> programming languages offer "qq" or here documents?
so learn perl. and don't program c in perl.
JE> - Do you also object to \n, \t, and their cousins? They are exactly the
JE> same. Explicit newlines are not allowed in strings. Therefore you need a
JE> different way to denote them. Explicit double quotes are not allowed in
JE> strings. Therefore you need a different way to denote them. Why would you
JE> want to tread a double quote differently then a newline?
those are not the same. they are not quote chars. i never said not to
use \. i said not to escape QUOTE chars. big difference.
and perl allows internal newlines. and explicit double quotes are
allowed in all strings except for ones delimited by double quotes.
so escaping double quotes is ugly (you agreed), and there are plenty of
ways to handle them better, why why tolerate them?
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: Fri, 14 Jul 2000 14:39:34 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: PRINTing " "" "
Message-Id: <MPG.13d92870fc6a777598abcb@nntp.hpl.hp.com>
In article <x7k8eoinzn.fsf@home.sysarch.com> on Fri, 14 Jul 2000
18:08:12 GMT, Uri Guttman <uri@sysarch.com> says...
...
> so escaping double quotes is ugly (you agreed), and there are plenty of
> ways to handle them better, why why tolerate them?
Why tolerate them? Golf, of course! A string containing exactly one
quote is one stroke shorter if the string is backslashed than if
alternate quote characters are used.
"\"\n"
qq("\n)
All hail the PGA and its promoter.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 14 Jul 2000 14:10:56 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: printing out list of checkboxes to a file.
Message-Id: <396F57B0.F1ECC469@attglobal.net>
"Paul [[AGGTA] Total Fuckup]" wrote:
>
> Hello,
>
> Im having some big problems trying to get my CGI script to print a
> list of selected checkboxes to a file.
>
> What i have is a list of checkboxes called game and what i want my script
> to do is print out the check boxes that was selected to a file.
>
> Ive tried this:
>
> #!/usr/local/bin/perl
> use CGI 'param';
> print "Content-type: text/html\n\n";
> print join "," , param ( 'game' );
Uh. Hmmm. Lets see if I caught on. You have a bunch of checkboxes
all with the same name, and you want the selected variables? If so,
you can do like so to get them and put them in a file:
#!/usr/local/bin/perl -Tw
use strict;
use CGI qw/:standard/;
my @game_array = param('game');
print header; # better than print "Content-type: text/html\n\n";
open (CHECK, ">$filename") or die "can't open $filename: $!";
print CHECK map $_ . "\n" => @game_array;
close CHECK;
------------------------------
Date: Fri, 14 Jul 2000 08:24:18 -0700
From: cyan <cyan_01NOcySPAM@hotmail.com.invalid>
Subject: Q's about perl modules
Message-Id: <16e9f1fe.bf33b887@usw-ex0106-048.remarq.com>
Hi,
I have couple years of perl programming experiences. I would say I am
OK in perl in a general sense. However, I feel a little uncomfortable
about .pm's.
My general questions are :
1) How do I know how many pm's are available?
2) How many methods are in each pm?
3) How can I keep myself updated with all these pm's?
4) More specificly, what's GetOptions() for? I know it is in
Getopt::Long.
You help is highly appreacited.
cyan
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: Fri, 14 Jul 2000 13:32:18 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: Q's about perl modules
Message-Id: <8knte3$23r$1@brokaw.wa.com>
cyan <cyan_01NOcySPAM@hotmail.com.invalid> wrote in message
news:16e9f1fe.bf33b887@usw-ex0106-048.remarq.com...
> Hi,
>
> I have couple years of perl programming experiences. I would say I am
> OK in perl in a general sense. However, I feel a little uncomfortable
> about .pm's.
>
> My general questions are :
> 1) How do I know how many pm's are available?
Available where?
CPAN: innumerable (maybe numerable, actually...)
Your system: http://www.perlfaq.com/faqs/id/205
> 2) How many methods are in each pm?
perldoc <module name>
> 3) How can I keep myself updated with all these pm's?
Do a diff on CPAN everyday and read the new additions. This may take a
while.
> 4) More specificly, what's GetOptions() for? I know it is in
> Getopt::Long.
perldoc Getopt::Long
>
> You help is highly appreacited.
Glad I could help!
Lauren
------------------------------
Date: Fri, 14 Jul 2000 21:37:32 +0200
From: Ulrich Ackermann <UlleAckermann@t-online.de>
Subject: Re: Q's about perl modules
Message-Id: <396F6BFC.B6381C5B@t-online.de>
cyan wrote:
>
> My general questions are :
> 1) How do I know how many pm's are available?
Why do have to now there number? I just care about the ones I need. That
are quit enough ;-)
> 2) How many methods are in each pm?
Just look inside the modules you are interested in. They're plain ascii.
> 3) How can I keep myself updated with all these pm's?
Visit your local CPAN mirror and have a look if there's a new release.
> 4) More specificly, what's GetOptions() for? I know it is in
> Getopt::Long.
I think this ones mentioned in the Camel book. In general Getopt::Long
is for getting commandline options comfortable into your Perl script.
If you need more information about this: install it and read the docu.
> You help is highly appreacited.
HTH
Ulrich
------------------------------
Date: 14 Jul 2000 20:01:45 GMT
From: nobody@contract.Sun.COM (Nobody)
Subject: Re: Qs for professional Perl/CGI developers
Message-Id: <8knrj9$brv$1@eastnews1.east.sun.com>
>On Fri, 14 Jul 2000 00:01:47 GMT, Pjtg0707 <Pjtg0707@Netscape.net> wrote:
>
>
>>I am wondering how many of you guys are professional Perl/CGI developers?
>
I've been doing it on a consulting basis for ~4 years, both straight Perl
app and CGI.
>
>>If you work as a contractor, how do you make sure you don't get stiffed
>>by your clients?
>
>
Tough one. Make sure you have a firm written contract or use an agency.
>>Have you ever been stiffed before?
>
>
Yep, but not on a Perl job.
>
>>Is Perl the only thing you do?
>
Nope.
>>What is the general going rate for a Perl developer?
>
>
It varies. I've gotten as much as $90/hour, but there were other
requirements besides Perl (database, web-related stuff of all types,
OO, admin, etc...) In this market, I won't work for less than $75/hr.
Note: This is in the Boston area, where the demand is so high (for Perl
and anything web-related) that I could employ a dozen or so
of me...if only I could clone myself :-) I've about hit my limit with
3 contracts though (two are Perl, database, CGI type stuff).
If you're looking to get into contracting in Perl, now is a good time
to do it.
Anita
------------------------------
Date: Fri, 14 Jul 2000 22:01:55 +0200
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Redirect External Program's output on Windows ?
Message-Id: <24sums83q7t615qptvr0ck9aqfcjiv0g9v@4ax.com>
joerg@sql.de wrote:
>I need to call external programs that write to their "standard
>output", but I need to keep that text in files.
Can be done...
>I would prefer to include "standard error" with the output.
but not this, AFAIK.
>On Unix, I call "system" with a string parameter that contains
>redirection characters:
> system "program arg1 arg2 > result"
>or even
> system "program arg1 arg2 > result 2>&1"
If you do
open STDOUT, ">stdout.txt";
open STDERR, ">stderr.txt";
and THEN call an external program, it's STDOUT and STDERR will go their
own file each.
Unfortunately,
open STDERR, ">&STDOUT";
does not have the desired effect.
--
Bart.
------------------------------
Date: Fri, 14 Jul 2000 17:58:17 GMT
From: hamed53@my-deja.com
Subject: Sending a Escape using Net::Telnet
Message-Id: <8knkbf$no2$1@nnrp1.deja.com>
Hi...
I am using Net::Telnet to connect to a program of mine... that program
is menu based, which for example if i like to go select any options in
the menu i have to type the options number, for example 1, or... and if
i wanted to go to previuos menu i need to press ESC... and that referes
me to the previuos menu...
Now... i can connect to that program and go to any option in any menu,
but if i wanted to change to another menu and get another info, i have
to send ESC to go there, i cant figure out how to send this ESC in
Net::Telnet...
Can anyone help?
Best regards
Hamed
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 14 Jul 2000 17:58:28 GMT
From: hamed53@my-deja.com
Subject: Sending an Escape using Net::Telnet
Message-Id: <8knkbp$no6$1@nnrp1.deja.com>
Hi...
I am using Net::Telnet to connect to a program of mine... that program
is menu based, which for example if i like to go select any options in
the menu i have to type the options number, for example 1, or... and if
i wanted to go to previuos menu i need to press ESC... and that referes
me to the previuos menu...
Now... i can connect to that program and go to any option in any menu,
but if i wanted to change to another menu and get another info, i have
to send ESC to go there, i cant figure out how to send this ESC in
Net::Telnet...
Can anyone help?
Best regards
Hamed
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 14 Jul 2000 12:05:46 -0700
From: "Jürgen Exner" <juex@deja.com>
Subject: Re: Silly Question?
Message-Id: <396f64de$1@news.microsoft.com>
"Richard Cole" <r.cole@gu.edu.au> wrote in message
news:396EBADE.E0B17DD@gu.edu.au...
>
> I'm a beginner to perl and I tried the following programs:
>
> $A = "A\nB";
> if ( $A == "" ) { print "empty"; };
>
> and
>
> $A = "A\nB";
> if ( $A != "" ) { print "not empty"; };
>
> and
>
> $A = "A\nB";
> if (! $A == "") { print "not empty"; };
>
> The first two didn't produce any output but the third one did. This
> seems a tad inconsistent to me.
Aside from the obvious mistake of using numerical comparision to compare
strings I don't quite get the behaviour either.
I guess it comes down to what is the numerical value of "" (i.e. the empty
string)?
Either it is 0 (zero), then the first example should fire. Or it is not 0,
then the second example should fire.
Or is it because when used for a comparison the "" is evaluated in a boolean
context (instead of in a numerical context) and the resulting "false" when
used in any numerical comparison yields "false"?
Just wondering
jue
------------------------------
Date: Fri, 14 Jul 2000 15:39:12 -0500
From: "Jim Kauzlarich" <o1technospam@skyenet.nospam.net>
Subject: Re: Silly Question?
Message-Id: <NMKb5.199$Mt6.1088@newsfeed.slurp.net>
"Keith Calvert Ivey" <kcivey@cpcug.org> wrote in message
news:39701117.37152528@nntp.idsonline.com...
> "Jim Kauzlarich" <o1technospam@skyenet.nospam.net> wrote:
>
> >if ( $A = "" )
> >will never be false, and $A (after that if) will always be ""
> > = is an assignment operater. The only way that if ( $A = "" ) could be
> >false is if for some reason $A could not be set to "". And I'm guessing
> >that a run-time or compilation err would be more likely.
>
> You're misunderstanding the return value of an = expression.
> The condition $A = "" will *always* be false, because "" is
> false. But you are, of course, right in saying that HiTekHick's
> answer was completely wrong.
>
Thank you. I appreciate the info.
------------------------------
Date: Fri, 14 Jul 2000 19:26:16 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: String length?
Message-Id: <smuqaomand6123@corp.supernews.com>
jason (elephant@squirrelgroup.com) wrote:
: Craig Berry wrote ..
: >Strict can take an argument list, to determine what kinds of strictness
: >you want. This was just interpreted as an empty list, indicating that you
: >want full strictness.
:
: actually .. an empty list means that you want no strictness at all
'Scuse me, I goofed. Forgot that an empty arg list was different from a
lack of arguments. Thanks for the catch.
--
| Craig Berry - http://www.cinenet.net/users/cberry/home.html
--*-- "Beauty and strength, leaping laughter and delicious
| languor, force and fire, are of us." - Liber AL II:20
------------------------------
Date: Fri, 14 Jul 2000 15:00:43 -0500
From: "Jim Kauzlarich" <o1technospam@skyenet.nospam.net>
Subject: Re: String length?
Message-Id: <GcKb5.181$Mt6.849@newsfeed.slurp.net>
"Tad McClellan" <tadmc@metronet.com> wrote in message
news:slrn8mua1t.dbt.tadmc@magna.metronet.com...
> On Fri, 14 Jul 2000 01:45:56 -0500, Jim Kauzlarich
<o1technospam@skyenet.nospam.net> wrote:
>> Jim Kauzlarich (o1technospam@skyenet.nospam.net) wrote:
> >Tanx, and l8r
>
>
> Please avoid the IRC style of misspellings here.
>
> We prefer the old fashioned form of misspelling on Usenet.
>
> (i.e. the unintentional ones)
>
Sheesh. Just trying to be friendly. (And don't worry, I'll probably supply
pleanty of the "acceptable" misspellings. I need to install a spell checker
on my workstation.)
And, btw, my use of "Tanx" dates back over 15 years, to when 300 baud was
king, and I dialed into loacal BBS's. I believe (though am not sure) that
pre-dates IRC.
JMK
------------------------------
Date: Fri, 14 Jul 2000 15:35:44 -0500
From: "Jim Kauzlarich" <o1technospam@skyenet.nospam.net>
Subject: Re: String length?
Message-Id: <wJKb5.195$Mt6.960@newsfeed.slurp.net>
"Tad McClellan" <tadmc@metronet.com> wrote in message
news:slrn8mu8q7.dbt.tadmc@magna.metronet.com...
> On Fri, 14 Jul 2000 04:05:45 -0500, Jim Kauzlarich
<o1technospam@skyenet.nospam.net> wrote:
> >
> >"Craig Berry" <cberry@cinenet.net> wrote in message
> >news:smtel1icnd6138@corp.supernews.com...
>
> >> See the discussion on
> >> packages in the Camel book.
> >
> >Which one?
>
>
> There _is_ only one Camel book...
>
>
> >"Programming Perl"?
>
>
> ... and that is it.
>
My confusion came from the fact that, looking in the back of my "Learning
Pearl" book, I see Camels on "Perl 5 Desktop Reference", "Perl in a
nutshell", and the "Perl Resouce Kit" (I realize is more than a book) and
did not know if that was a complete list.
JMK
------------------------------
Date: Fri, 14 Jul 2000 18:22:04 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: strings and symbol refs and strict - oh my!
Message-Id: <7a8zv4k1wx.fsf@merlin.hyperchip.com>
Nnickee <nnickee@nnickee.com> writes:
> On Fri, 14 Jul 2000 14:49:18 +0930, someone claiming to be "Wyzelli"
> <wyzelli@yahoo.com> said:
> >print $num." ".$alph;
>
> I hate that too. Not only ugly, it's too many characters (not that
> I'm anywhere near good enough to start playing Golf yet, but still :)
>
> >print "$num $alph"; # so much nicer looking...
>
> Yeah, it is. And that's how I've written 99% of my print statements
> when I haven't used here docs. Now that I'm trying to get into the
> habit of using strict, I have to unlearn some bad habits :) And
> again, perlfaq4 says that quoting vars is a bad thing to do most of
> the time, so that's why I asked about better ways to do it.
Well, what perlfaq4 says is correct, but what you want to do is
different. You want to create a string that happens to be the contents
of your two variables separated by a space. There is nothing wrong with
doing:
print "$num $alph"
But, this is definitely wrong:
my $ref = [qw/a b c/];
my $copy = "$ref";
Now $ref is a reference to an anonymous array, but $copy is not. It is
simply a string of the form "ARRAY(0x80e4fc0)" which can NOT be used to
retrieve back the contents of the anonymous arrays. Losing the quotes
around $ref in the assignment to $copy, though, will change this.
--Ala
------------------------------
Date: Fri, 14 Jul 2000 13:13:39 -0500
From: "Paul R. Andersen" <panderse@us.ibm.com>
Subject: Re: system question
Message-Id: <396F5853.FD5D0A0B@us.ibm.com>
spock0000@my-deja.com wrote:
>
> Ok, I'm using the system command to call the su Unix routine on an AIX
> 4.3.3 system. I'm using cgi to grab a username and passwords and
> putting them into variables. The program will run the su system command
> with the correct username from the cgi field, but I don't know how to
> supply the password that the su routine requires. Because it's no
> longer a shell prompt, another system call doesn't work. right now my
> program gets stuck on a "Please enter "username"'s password:" prompt.
> Any ideas?
There was a long discussion on the topic of doing an su awhile back.
The two points that came out were 1) you can't do that directly and 2)
If you could it would be a security nightmare. Search back through the
archives for stuff about su. (The main reason you can't do it easily is
that su creates a new shell that knows nothing about the Perl program
you have running.)
--
Paul Andersen
+++++++++++++
The difference between theory and practice is that in theory there is no
difference between theory and practice; but in practice there is.
------------------------------
Date: Fri, 14 Jul 2000 14:17:33 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: The problem of two Submit buttons
Message-Id: <MPG.13d92348971cb83298abca@nntp.hpl.hp.com>
In article <963583114.8285@itz.pp.sci.fi> on 14 Jul 2000 14:00:29 GMT,
Ilmari Karonen <iltzu@sci.invalid> says...
> In article <Pine.GHP.4.21.0007141529330.20198-100000@hpplus03.cern.ch>, Alan J. Flavell wrote:
> >On Fri, 14 Jul 2000, Philip Lees wrote:
> >
> >> if ( ! $add_button eq "" ){
> >> #add something
> >
> >Boggle. Do you normally test for the negative of what you didn't
> >want?
>
> Could've been worse. He might have written it as:
>
> unless ( ! $add_button ne "" ){
Each of those is nonsense, because '!' binds with very high precedence
to the succeeding operand. So the logical negation of any string other
than '0' is the null string.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 14 Jul 2000 22:10:23 +0000
From: rhys <rhys.tucker@dtn.ntl.com>
Subject: Trying to use an array as a hash value
Message-Id: <396F8FCF.19957183@dtn.ntl.com>
While trying to use Mail::Sendmail I'm having trouble passing an array
to the Message value of the %mail hash. Ideally what I want to do is
slurp up a file into an array - @message = <MESSAGE>; and use this
somehow.
I've been wondering that the solution may be to slurp up the file into a
scalar variable somehow?.
%mail = ( To => $email_address,
From => 'me@here.com',
Message => $message, # problem - want to use an array as
a # hash value
Subject => $subject,
);
------------------------------
Date: Fri, 14 Jul 2000 20:50:55 +0200
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Upper-to-lower case problem
Message-Id: <hjnumsoj1bcg4rkcfd4u3nl6fgrcrnp7dp@4ax.com>
Alan Page wrote:
>Here's the whole script; there's not much to it. It runs fine without the
>case-change piece; when a visitor inputs a batch number (a-f) and a photo
>number (759 - 999), the script redirects them to a web page of the same name.
>
>For example, the user puts in "b" and "811"; the script returns
>http://www.sizzlinsummer.com/sf/pages/b811.htm
>
>I'm just trying to eliminate them putting in "B" instead of "b"
You'd better do some taint checking. You're assuming too much about the
user data. Turning "B" inot "b" is precisely the kind of thing I'm
talking about, but... are you sure the user actually does input one
letter in the range 'a' to 'f'? No, you're not. So, you'd better check.
>#Get batch number (a,b,c,d,e,f)
>$batch = $input{'batch'};
>
>#Convert to lowercase
>$batch =~ tr/A-Z/a-z/;
There's also the lc function.
Taint check:
$valid = 1; # assumed, for now
if($input{'batch'} =~ /^([a-fA-F)$/) {
$batch = lc $1;
} else {
&error("Not a valid batch");
$valid = 0;
}
>#Get photo number (759 - 999)
>$photo = $input{'photo'};
if($input{'photo'} =~ /^(\d\d\d)$/ &&
$1 >= 759) {
$photo = $1;
} else {
&error("invalid photo number");
$valid = 0;
}
>##See whether user left any fields blank##
This check is now unnecessary.
The rest of the script looks alright (good enough for me).
--
Bart.
------------------------------
Date: Fri, 14 Jul 2000 12:16:40 -0700
From: "Jürgen Exner" <juex@deja.com>
Subject: Re: Upper-to-lower case problem
Message-Id: <396f676c$1@news.microsoft.com>
"Alan Page" <alandpage@aol.comnospam> wrote in message
news:20000714005108.07703.00001224@ng-ch1.aol.com...
> Hello again,
>
> Got an easy one this time. I'm trying to convert a variable's content from
> upper to lower case using:
>
> ...
> $batch = $input{'batch'};
> $batch =~ tr/A-Z/a-z/;
Which of course doesn't work in 95% of the world (hint: you are missing the
conversion for any extended character).
Use "lc" instead.
> But whenever I add that second line to an otherwise functional script, I
get a
> 500 Internal Server Error with this detail in my server error log:
> Can't open perl script "
> ": No such file or directory
> [Thu Jul 13 20:52:11 2000] [error] [client 209.66.144.2] Premature end of
> script headers
This is certainly not a Perl problem.
jue
------------------------------
Date: Fri, 14 Jul 2000 20:42:00 GMT
From: Andrei <andrei@unforgettable.com>
Subject: Re: Use strict & subroutines
Message-Id: <8kntuk$vgt$1@nnrp1.deja.com>
Hi and thanks to all of you
yes, I tried it and it refers only to the subroutine.
I read the strict pages but not the perlmodlib. Shame on me !
Andrei
In article <slrn8mub6u.dbt.tadmc@magna.metronet.com>,
tadmc@metronet.com (Tad McClellan) wrote:
> On Fri, 14 Jul 2000 09:07:03 GMT, Andrei <andrei@unforgettable.com>
wrote:
>
> >If I use "use strict" in a subroutine does it refer only to that
> >subroutine or to the whole script ?
>
> What happened when you tried it?
>
> --
> Tad McClellan SGML Consulting
> tadmc@metronet.com Perl programming
> Fort Worth, Texas
>
--
Andrei Gologan
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 14 Jul 2000 16:06:32 -0400
From: H C <carvdawg@patriot.net>
Subject: Re: w32 module
Message-Id: <396F72C8.878E7528@patriot.net>
why not use PPM
c:\perl\bin>ppm install
http://www.roth.net/perl/packages/Win32-AdminMisc.ppd
Sergio Sanchez wrote:
> I am trying to install the AdminMisc extension for Win32 Perl and
> according to the instruction s in the readme file it references a file i
> dont have in the zip.
>
> ------------------------------------------------------
> HOW TO INSTALL:
> - IF you are using the ActiveState version of Win32 Perl:
> a) Copy the ADMINMISC.PM file into the directory perl\lib\win32\
> b) Rename the file ADMINMISC_XXX.PLL to ADMINMISC.PLL <--i dont
> have it
> c) Make a directory: perl\lib\auto\win32\adminmisc\
> d) Copy the ADMINMISC.PLL file into the directory in step c
>
> thanks in advance
>
> surge
------------------------------
Date: Fri, 14 Jul 2000 12:12:13 -0600
From: Dan Woods <dwoods@ucalgary.ca>
To: tallisyn@my-deja.com
Subject: Re: Windmail/NT CGI script not sending mail
Message-Id: <396F57FD.AB0AEBC1@ucalgary.ca>
tallisyn@my-deja.com wrote:
>
> Dan,
>
> Have you considered using SMTP to send your
> email? We have an NT perl script that sends mail
> using SMTP. The advantage is that your script
> isn't bound to a mailer on the same machine --
> you can use any open SMTP gateway to send it.
> You may be able to find an SMTP mailer in perl on
> the web somewhere. If not, I can email you the
> one we use -- it's freeware.
>
> Tim
Yes, please send me a copy. I always like to look at
different examples for learning and choosing the best
one for the job.
At this point, I was looking at trying SMTP mailers, or
using MIME::Lite but I may not be allowed to install it.
Thanks...Dan.
------------------------------
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 3673
**************************************