[13027] in Perl-Users-Digest
Perl-Users Digest, Issue: 437 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 9 22:07:15 1999
Date: Mon, 9 Aug 1999 19: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)
Perl-Users Digest Mon, 9 Aug 1999 Volume: 9 Number: 437
Today's topics:
ActivePerl PerlScript -- funny problems <john@dlugosz.com>
Re: bracket syntax (Matthew David Zimmerman)
Re: Comm package (Martien Verbruggen)
Custer's Last Code <fkrul@acc.com>
Re: Custer's Last Code (Randal L. Schwartz)
Get first letter of string? <phony@nospam.com>
Re: Get first letter of string? <dhill@sunbeach.net>
Re: Get first letter of string? (Matthew David Zimmerman)
Re: Multithreading (Martien Verbruggen)
Re: Multithreading <dan@tuatha.sidhe.org>
Re: Perl in a chroot'ed environment (Martien Verbruggen)
Re: pricing a perl job <max@maxgraphic.com>
Re: print to file using here document (Jflowers44)
Re: Problem dynamically loading modules via eval (Martien Verbruggen)
Re: Reading the Online Documentation? <flavell@mail.cern.ch>
Re: Reading the Online Documentation? <revjack@radix.net>
Re: Reading the Online Documentation? <kperrier@blkbox.com>
Re: Reading the Online Documentation? (Larry Rosler)
Re: Reading the Online Documentation? <markm@nortelnetworks.com>
Re: Reading the Online Documentation? (Marcel Grunauer)
Re: Reading the Online Documentation? <mhc@Eng.Sun.COM>
Re: send perl-users mini-faq (John Stanley)
Re: Simple write routine (Martien Verbruggen)
system command syntax question (Tom Shou)
UpperCase first letter of string only. <phony@nospam.com>
Re: UpperCase first letter of string only. (brian d foy)
Re: UpperCase first letter of string only. <makkulka@cisco.REMOVETHIS.com>
Re: UpperCase first letter of string only. (Graham Ashton)
Re: UpperCase first letter of string only. (Marcel Grunauer)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 9 Aug 1999 20:10:00 -0500
From: "John M. Dlugosz" <john@dlugosz.com>
Subject: ActivePerl PerlScript -- funny problems
Message-Id: <9AAE839D71B8FC6D.3AB3323DC4B76392.3902CF75BC3996F5@lp.airnews.net>
Here is an illustration of the problem I mentioned earlier (see test.html
file below). If $main::document is assigned to, the Perl engine crashes.
It doesn't even have to execute that statement -- just having it in the
script is enough! When the problem line is commented out, you will see a
report on all the symbols in the main package. 'document' is not one of
them.
Can anybody shed some light on this, please?
--John
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
"http://www.w3.org/TR/REC-html40/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>script testing</title>
<SCRIPT LANGUAGE="PerlScript">
sub foo
{
foreach $name (sort keys %main::) {
$window->document->write ("$name<BR>");
}
}
sub bar
{
# this works.
$documentX= 5;
#this crashes Perl
# $document= 5; #un-comment this line to illustrate problem.
}
</SCRIPT>
</head>
<body>
<SCRIPT LANGUAGE="PerlScript">
foo();
# note that bar isn't called! The presence of $document= in the program is
enough to cause problems.
</SCRIPT>
</body>
------------------------------
Date: 10 Aug 1999 01:32:07 GMT
From: mdz4c@node1.unix.Virginia.EDU (Matthew David Zimmerman)
Subject: Re: bracket syntax
Message-Id: <7onven$337$1@murdoch.acc.Virginia.EDU>
In article <37AF1AD9.638CFCCB@texas.net>, Tom Briles <sariq@texas.net> wrote:
>Abominable Sonoman wrote:
>> for example, sometimes when i say something like
>>
>> $something = "file";
>> $exp = "abc";
>>
>> $word = $something.${exp}_1234; #say this is line 56
>>
>> the unix thing complains, saying "Ambiguous use of ${exp} resolved to
>> $exp at line 56" or something like that.
>
>perldoc perldiag
>
>will give additional insight. Read the explanation carefully.
perldoc perldiag sez:
###
Ambiguous use of %s resolved as %s
(W)(S) You said something that may not be interpreted the way you
thought. Normally it's pretty easy to disambiguate it by supplying a
missing quote, operator, parenthesis pair or declaration.
###
It's not ambiguous because of the way it's parsing the variable, ie the
brackets, but it's confused about the whole line. It needs quotes.
Without quotes, it's thinking of the "." and the "_" as operators, not
literal characters.
Try this.
---
$something = 'file';
$exp = 'abc';
#if the period is supposed to be a literal period, use
$word = "$something.${exp}_1234"; # $word is 'file.abc_1234'
#if the period is supposed to be a concatenation operator
$word = $something . "${exp}_1234"; # $word is 'fileabc_1234'
---
Notice I still need the brackets, too. You were right about that.
Otherwise perl will think the second variable is $exp_1234.
>> I am not even using the -w switch
>
>Ah, but you should. *Always*. And it's better to start using Perl's
>built-in pragmata sooner than later.
Yes, you should. I'll agree with that. And if you include the pragmata:
###
use diagnostics;
###
near the top of your programs, it will print out the full message listed
in perldiag right into your error log. Nifty!
Good luck!
--
Matthew Zimmerman ------------ http://www.people.virginia.edu/~mdz4c
Interdisciplinary Biophysics Program --------- University of Virginia
| "You got to be very careful if you don't know where you're going, |
| because you might not get there." -- Yogi Berra |
------------------------------
Date: Tue, 10 Aug 1999 00:13:38 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Comm package
Message-Id: <S8Kr3.5121$rR.5058@nsw.nnrp.telstra.net>
In article <4cFr3.1049$8X1.95416@pm01news>,
"Monty Scroggins" <Monty.Scroggins@mci.com> writes:
> Does anyone know of a better way to telnet to a remote machine and
Better than what? The telnet command? The Net::Telnet module? Are you
sure you want telnet? rlogin would do? rsh?
> have the terminal stay up for an interactive session???
have the terminal stay up? Huh? The terminal always stays up for me.
> or does anyone
> know about the Comm.pl package (I cant find it referenced in CPAN)??
Don't know a thing about it.
> I am using Net::Telnet in a script to telnet to remote machines.
Good. but... If it's an interactive session, why don't you just get
yourself a decent terminal program and use telnet?
Net::Telnet wasn't really meant to be interactive.
Martien
--
Martien Verbruggen |
Interactive Media Division | +++ Out of Cheese Error +++ Reinstall
Commercial Dynamics Pty. Ltd. | Universe and Reboot +++
NSW, Australia |
------------------------------
Date: Mon, 09 Aug 1999 17:41:01 -0700
From: Frank Krul <fkrul@acc.com>
Subject: Custer's Last Code
Message-Id: <37AF751D.7A1A5B46@acc.com>
Hi Everybody,
I have an interesting situation that has made me reach out to see if
this wheel has already been invented. Please bear with me as it does
involve an overwiew of the situation (web based!).
I'm running a web server as user "nobody" on a Solaris machine. A cgi
perl script has to access files in a directory that is chmoded 750. I
can't change these permissions, I don't want to add "nobody" into the
group for security reasons, and it can't be the owner either. So I have
to make sure my perl script can do this. I set uid so the perl runs as
my username which is in the group, but I still had an error from Perl:
Insecure $ENV{PATH} while running setuid at /dev/fd/3 line 120.
So I thought I could circumvent the simple system calls that generated
these errors:
open(LS, "ls -l $directory |") || &error('file_access');
to a forked process like the following code and get away with doing the
same thing in a round about way:
$program = "ls -l $directory";
pipe(README, WRITEME);
if($pid = fork) {
# parent
$SIG{CHLD} = sub { 1 while ( waitpid(-1, WNOHANG)) > 0 };
close(WRITEME);
} else {
die "cannot fork: $!" unless defined $pid;
# child
open(STDOUT, ">&=WRITEME") or die "no direct STDOUT: $!";
close(readme);
exec("$program") or die "no program run : $!\n";
}
Of course, the error still occurs (only slower :).
Somebody told me a way of precompiling perl code....but I can't find any
mention of this. Do I need to recompile perl in any way? Modules? Any
help would be greatly appreciated.
------------------------------
Date: 09 Aug 1999 18:34:25 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Custer's Last Code
Message-Id: <m1aes0h10e.fsf@halfdome.holdit.com>
>>>>> "Frank" == Frank Krul <fkrul@acc.com> writes:
[story about getting this error:]
Frank> Insecure $ENV{PATH} while running setuid at /dev/fd/3 line 120.
[and then solution working around by forking manually]
Uh, why didn't you just fix the error that it says, rather than trying
to work around it?
Set $ENV{PATH} to a value that didn't come from the outside world.
This will work:
$ENV{PATH} = "/bin:/usr/bin";
Or whatever your path should be.
Unless you wanna keep doing things the hard way.
print "Just another Perl hacker,"
--
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: 10 Aug 1999 00:10:29 GMT
From: "Bart Simpson" <phony@nospam.com>
Subject: Get first letter of string?
Message-Id: <7onqll$qlu$0@216.39.133.155>
my $mystring='hello';
How do I get the first letter of the string? or remove all the characters
except the first? So that $mystring will contain 'h'
--
Phony email address.
Reply to this newsgroup, not to email.
Thank you.
------------------------------
Date: Mon, 9 Aug 1999 20:28:52 -0400
From: Duncan Hill <dhill@sunbeach.net>
Subject: Re: Get first letter of string?
Message-Id: <Pine.LNX.4.10.9908092028250.15136-100000@bajan.pct.edu>
On 10 Aug 1999, Bart Simpson wrote:
> my $mystring='hello';
>
> How do I get the first letter of the string? or remove all the characters
> except the first? So that $mystring will contain 'h'
perldoc -f substr
perldoc -f uc (for your next posting)
--
Duncan Hill Sapere aude
One net to rule them all, One net to find them,
One net to bring them all, and using Unix bind them.
------------------------------
Date: 10 Aug 1999 01:53:29 GMT
From: mdz4c@node5.unix.Virginia.EDU (Matthew David Zimmerman)
Subject: Re: Get first letter of string?
Message-Id: <7oo0mp$3f8$1@murdoch.acc.Virginia.EDU>
In article <Pine.LNX.4.10.9908092028250.15136-100000@bajan.pct.edu>,
Duncan Hill <dhill@sunbeach.net> wrote:
>perldoc -f substr
>perldoc -f uc (for your next posting)
Impressive! You must have the ESP::Clairvoyance module up and
running. :)
--
Matthew Zimmerman ------------ http://www.people.virginia.edu/~mdz4c
Interdisciplinary Biophysics Program --------- University of Virginia
| "You got to be very careful if you don't know where you're going, |
| because you might not get there." -- Yogi Berra |
------------------------------
Date: Tue, 10 Aug 1999 00:53:45 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Multithreading
Message-Id: <tKKr3.5355$rR.5058@nsw.nnrp.telstra.net>
In article <37AF3CB0.EB8FFC9@coolmail.net>,
frEEk <freek@coolmail.net> writes:
> I
> am trying to find the Thread module, but can only find the pod (on the
> perl.com site). I need to know where I can get it and how much lighter
> threading is than forking. Also, do I have to rebuild perl from source
> to enable threading?
Yes. That is what you need to do. It'll install the module when you
configure with -Dusethreads. (The source documentation says so. I
suspect you missed that when you were reading it)
Whether lightweight threads are faster/lighter than forks depends on
many factors. Nowadays OS's are a lot better at forking than they used
to be. They're also more efficient in conserving memory.
Read the README.threads in the source distribution for more info about
bugs and so on.
> I do not want the whole interpreter/execution to be
> threaded, just where I multithread it (like forking).
Doesn't work that way. perl builds threaded or non-threaded. You pay a
constant penalty if you build it threaded, many things are
consistently and always slower in the threaded version, and there are
bugs to deal with. There are also issues with the global variables
that you need to be aware of. And many modules may not be
thread aware.
I'm not entirely sure what the status of multithreaded perl is at the
moment, or how it is going to be in the 5.6 version, but I'd be
careful using it right now.
Martien
--
Martien Verbruggen |
Interactive Media Division | In the fight between you and the world,
Commercial Dynamics Pty. Ltd. | back the world - Franz Kafka
NSW, Australia |
------------------------------
Date: Tue, 10 Aug 1999 01:02:42 GMT
From: <dan@tuatha.sidhe.org>
Subject: Re: Multithreading
Message-Id: <SSKr3.51$SM.128@news.rdc1.ct.home.com>
frEEk <freek@coolmail.net> wrote:
> I found the pod for the Thread package, but have not been able to find
> the actual module anywhere. It sounds like exactly what I need. I have
> been forking up till now, but this has been causing errors in mysql, and
> it has 2 much overhead. Anybody know where to get the module, and
> possibly how much faster it is to create a thread than to fork?
The thread module comes with all perl distributions as of 5.005. You need
to specifically decide to use it when you build perl--it's not a decision
that can be made adter the fact.
As to how much faster, well, that depends on your platform. On WinNT, a
*lot* (like orders of magnitide). On Linux less so, though resource usage
is usually reduced going threaded versus forking.
Why exactly do you need 50 processes anyway? You might find that there's a
better way to do what you're doing. (I'm betting that neither fork nor
threads will really solve the problem you're having...)
Dan
------------------------------
Date: Tue, 10 Aug 1999 00:35:19 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Perl in a chroot'ed environment
Message-Id: <btKr3.5349$rR.5058@nsw.nnrp.telstra.net>
In article <7omm4o$kdh$1@barbican.eh.pweh.com>,
miorelli@pweh.com (BoB Miorelli) writes:
> I'm running perl in a chroot'ed environment and all works (so far)
> except the 'glob' command.
And anything else that needs /bin/sh
> This works in a shell:
>
> perl -e 'glob"*";'
But not if you're chrooted.
> internal error: glob failed at -e line 1.
glob invokes a shell, so you will have to have a /bin/sh in your
chrooted environment. If you chroot to /usr/private, there will have
to be a /usr/private/bin/sh for this to work. And it can't be a
symlink back to the real /bin/sh. That would defeat the purpose of a
chroot().
# man perlop
[snip]
I/O Operators
[snip]
Because globbing invokes a shell, it's often faster to call
readdir() yourself and do your own grep() on the filenames.
[snip]
> What does perl use to perform a glob so that I may place it in
> the chroot'ed environment?
See above, but it's definitely better to use opendir/readdir
Martien
PS. I consider glob to be harmful.
--
Martien Verbruggen |
Interactive Media Division |
Commercial Dynamics Pty. Ltd. | Can't say that it is, 'cause it ain't.
NSW, Australia |
------------------------------
Date: Mon, 09 Aug 1999 17:43:14 -0700
From: Max Pinton <max@maxgraphic.com>
Subject: Re: pricing a perl job
Message-Id: <090819991743144695%max@maxgraphic.com>
I hope you're joking. I'm asking for a rough estimate of cost for
writing the Perl script I described. It has to do with Perl in that
only a Perl scripter would be able to make such an estimate. I'm a
graphic designer, but wrote the script without a contract for a client
that I've worked closely with for a long time, and would like to charge
her fairly for the work I did.
Would I have gotten a real response if I had posed as a client looking
for a quote? Or has usenet simply ceased being a useful resource?
In article <brian-ya02408000R0908991445060001@news.panix.com>, brian d
foy <brian@pm.org> wrote:
> In article <090819990037311725%max@maxgraphic.com>, Max Pinton
> <max@maxgraphic.com> posted:
>
> > I just finished my largest perl project to date, and I'm wondering what
> > to bill. It took me about 16 hours, but I'm a newbie and much of that
> > time was debugging and head-scratching. It's a job-tracking site, and
> > can:
>
> there a few problems with asking this sort of question:
>
> * it has questionable legality. see books that talk about
> consulting, price-fixing, and collusion.
>
> * your price depends on what your time is worth, not on what
> you actually do with that time. if you are really busy, your
> price is higher.
>
> * your price is the most that you can get the client to pay,
> as in any business. this has long-term considerations as well.
>
> * all of this should have been decided BEFORE you started work.
> never work without a signed contract. don't start because the
> contract is "in the mail". wait for the ink.
>
> this has nothing to do with Perl since it's the same whether you are
> doing any sort of contractual work, even if it isn't programming.
------------------------------
Date: 10 Aug 1999 01:08:09 GMT
From: jflowers44@aol.com (Jflowers44)
Subject: Re: print to file using here document
Message-Id: <19990809210809.04810.00009744@ng-bk1.aol.com>
Here is the relevant code;
open (LOG, $filename);
print LOG << "(HTMLCODE)";
<HTML> <HEAD> <TITLE> Hello </TITLE> </HEAD>\n;
<BODY background = \"../backgrounds/$background\">;
<FONT COLOR = \"$fontcolor\">;
<H1> $heading </H1> <BR> $comments </FONT> </BODY> </HTML>;
(HTMLCODE)
close(LOG);
------------------------------
Date: Tue, 10 Aug 1999 00:06:08 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Problem dynamically loading modules via eval
Message-Id: <Q1Kr3.5010$rR.5058@nsw.nnrp.telstra.net>
In article <OHgsAEr4#GA.240@cpmsnbbsa02>,
"Bruce Pennypacker" <brucep@msn.com> writes:
> Here's an example of what I'm doing:
You are not running this with the -w flag, and you are not using
strict, are you? A straight copy of your code gives me some
errors and warnings. Quoting the 'CodeToEval' fixes that. You should
realise that " CodeToEval" is not the same as "CodeToEval".
either
my $command = <<CodeToEval;
or
my $command = << "CodeToEval";
You should also indent your code.
'Fixed' code follows:
use strict;
sub loadmodule {
my $self = @_;
$self->{test} = "this is a test";
print "self = $self\n";
my $parserobject;
my $module = "ps::ParseDSV";
my $command = << "CodeToEval";
use $module;
\$parserobject = new $module('$self');
CodeToEval
print $command;
}
my %aa;
loadmodule(\%aa);
Notice that I replaced the eval with a print?
Ok, this gives me:
Can't use string ("1") as a HASH ref while "strict refs" in use
at ./tt.pl line 8.
See? That's how I knew you either weren't running this with strict, or
you were calling this loadmodule thing the wrong way.o
Change:
my $self = shift; # Or use list context when using @_
When running this:
self = HASH(0xf0948)
use ps::ParseDSV;
$parserobject = new ps::ParseDSV('HASH(0xf0948)');
Aha. Yo are calling new, not with the reference, but with the string
representation of the reference. And you single quote that. Why?
Change that to:
my $command = << "CodeToEval";
use $module;
\$parserobject = new $module(\$self);
CodeToEval
Martien
--
Martien Verbruggen | My friend has a baby. I'm writing down
Interactive Media Division | all the noises the baby makes so later
Commercial Dynamics Pty. Ltd. | I can ask him what he meant - Steven
NSW, Australia | Wright
------------------------------
Date: Tue, 10 Aug 1999 01:40:15 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Reading the Online Documentation?
Message-Id: <Pine.HPP.3.95a.990810013938.4513B-100000@hpplus03.cern.ch>
On 9 Aug 1999, Mesarchm wrote:
> Get a life.
Learn to fish, or bog off. You aren't helping anybody.
------------------------------
Date: 10 Aug 1999 00:11:09 GMT
From: revjack <revjack@radix.net>
Subject: Re: Reading the Online Documentation?
Message-Id: <7onqmt$31$1@news1.Radix.Net>
Keywords: Hexapodia as the key insight
Mesarchm explains it all:
:The perfect example is Mr. Know it all (Just Another Larry) Rosler
I wish someone would call *me* "Mr. Know It All" :(
------------------------------
Date: 09 Aug 1999 19:13:09 -0500
From: Kent Perrier <kperrier@blkbox.com>
Subject: Re: Reading the Online Documentation?
Message-Id: <2D5D7ECC4BBDBFBA.AD134BC749FC9ABA.B9ABC9A93ACE95EA@lp.airnews.net>
mesarchm@aol.com (Mesarchm) writes:
> My point is that they obviosly tried the docs and it didn't make sense.
But it s apparent from their question that they didn't. There are a lot
of "how do I...." questions asked here that would have been answered if they
had looked at the docs/FAQ.
Kent
------------------------------
Date: Mon, 9 Aug 1999 17:22:21 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Reading the Online Documentation?
Message-Id: <MPG.12191099af3deb47989e14@nntp.hpl.hp.com>
In article <19990809193630.09549.00004471@ng-bj1.aol.com> on 09 Aug 1999
23:36:30 GMT, Mesarchm <mesarchm@aol.com> says...
> I am not argueing that the docs aren't the best place to look 1st. But what I
> am saying is that if people turn to you for help, being willing to help. The
> perfect example is Mr. Know it all (Just Another Larry) Rosler Hewlett-Packard
> Laboratories. He answers 90% of the posts on this newsgroup w/ "Read the Docs"
> Get a life. If you have nothing better to do then sit around all day and not
> help people then you really need to get out and get a life.
In article <MPG.1218fa367953999e989e13@nntp.hpl.hp.com> on Mon, 9 Aug
1999 15:46:51 -0700, Larry Rosler <lr@hpl.hp.com> says...
> In article <19990809181534.04942.00000452@ng-ch1.aol.com> on 09 Aug 1999
> 22:15:34 GMT, Mesarchm <mesarchm@aol.com> says...
> > I know how to sort a hash, but how do I sort it backwards. I am trying to sort
> > by time. Currently 0128 will come up first and the last one will be 2345. I
> > want it to be the opposite. The current code I am using is:
> >
> > foreach $alert (sort keys %notification)
> > {
> > compare($alert);
> > }
>
> From your previous post: "read the online documentation" :-)
>
> Specifically, perldoc -f reverse.
Which part of my response did you not understand? Did you "read the
online documentation" where I pointed to? If so, what did you try
afterwards? If it was not a complete solution, what more do you need?
Get a life.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 09 Aug 1999 20:33:10 -0400
From: Mark Mielke <markm@nortelnetworks.com>
Subject: Re: Reading the Online Documentation?
Message-Id: <lq1907ktqyh.fsf@bmers31f.ca.nortel.com>
M.Ray@ulcc.ac.uk (Malcolm Ray) writes:
> On 09 Aug 1999 22:11:13 GMT, Mesarchm <mesarchm@aol.com> wrote:
> >Why is it that everytime someone asks a question instead of being helpful
> >people reply with a "read the online documentation". If you don't want to
> >help someone out, don't. It is obvious that they are new to perl and need
> >some help. Sure you can mention that the docs are a good place to look,
> >but if you know the answer give it to them, don't be a ass.
> >Mike
> Stick around here and you'll see some *wrong* answers to questions.
> If I were a beginner with a problem, I'd be pretty annoyed to have
> my time wasted in that way. It's far better to be pointed to the
> *accurate* documentation - which, incidentally, will answer questions
> you didn't even know you had!
This is the MOST useful reason why should people should learn to read the
docs. While searching for one answer they will have to skim by a wealth
of OTHER information which might not even pertain to this specific problem.
Instead of solving situations as they hit them, they can see how they
could solve future situations BEFORE they hit them.
Personally, I learned perl from "man perl". Didn't ever bother reading
any O'Reilly books until I got a free "Advanced Perl Programming" book
when I went to a course taught by Tom Christiansen. The purpose of going
to the course wasn't to learn perl either... It was to meet Tom. :-)
"Advanced Perl Programming" was a very good book. It settled some of my
uncertainties concerning how globs worked.
Now I can use them without fear. :-)
I suggest that everybody read ALL of the manpages concerning perl at
least ONCE at some point in their perl programming life. Don't program
in reaction to problems... because then your always one step behind?
mark
--
markm@nortelnetworks.com/mark@mielke.cc/markm@ncf.ca __________________________
. . _ ._ . . .__ . . ._. .__ . . . .__ | CUE Development (4Y21)
|\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ | Nortel Networks
| | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, Ontario, Canada
One ring to rule them all, one ring to find them, one ring to bring them all
and in the darkness bind them...
http://mark.mielke.cc/
------------------------------
Date: Tue, 10 Aug 1999 01:46:57 GMT
From: marcel.grunauer@lovely.net (Marcel Grunauer)
Subject: Re: Reading the Online Documentation?
Message-Id: <37b78381.23316767@enews.newsguy.com>
On 09 Aug 1999 23:36:30 GMT, mesarchm@aol.com (Mesarchm) wrote:
>I am not argueing that the docs aren't the best place to look 1st. But what I
>am saying is that if people turn to you for help, being willing to help. The
>perfect example is Mr. Know it all (Just Another Larry) Rosler Hewlett-Packard
>Laboratories. He answers 90% of the posts on this newsgroup w/ "Read the Docs"
Because that's what you should do.
I haven't seen any answers from you yet, Mr Mesarchm AOL.com (checked
with deja), just FAQs. People who read this group simply aren't human
faqbots, least of all Larry Rosler.
It's rather arrogant to say "I've got this problem, but I couldn't be
bothered to read the documentation, so I'll just post it in front of
thousands of people. Worked last time, will work another fifty times."
Some people have spent a considerable amount of time and effort
creating that very same documentation you so easily discard.
Marcel
--
perl -e 'print unpack(q$u$,q$82G5S="!!;F]T:&5R(%!E<FP@2&%C:V5R$)'
------------------------------
Date: 09 Aug 1999 18:47:12 -0700
From: Mike Coffin <mhc@Eng.Sun.COM>
Subject: Re: Reading the Online Documentation?
Message-Id: <8p6g11sl84f.fsf@Eng.Sun.COM>
mesarchm@aol.com (Mesarchm) writes:
> Why is it that everytime someone asks a question instead of being
> helpful people reply with a "read the online documentation". If you
> don't want to help someone out, don't. It is obvious that they are
> new to perl and need some help. Sure you can mention that the docs
> are a good place to look, but if you know the answer give it to
> them, don't be a ass.
You just don't get it, do you? What do you do if your child or spouse
makes a mistake? You berate her loudly in public for being an idiot,
of course. By being demeaning, you ensure that will she be more
careful in the future. Better yet, other people---seeing her public
humiliation---will think twice before they open their mouths.
Humiliation and ridicule are used by *all* the best teachers.
Right?
-mike
------------------------------
Date: 10 Aug 1999 01:15:49 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: send perl-users mini-faq
Message-Id: <7onug5$jku$1@news.NERO.NET>
In article <37AF1D1D.E5128D03@mail.cor.epa.gov>,
David Cassell <cassell@mail.cor.epa.gov> wrote:
>Dennis [and others who have wondered about this]:
>
>I checked, and this is actually the same Bill Jones who has been
>providing reasonably correct answers here under the alias Sneex.
>He is currently at the mercy of some sysadmins who are mucking things
>up for him, and he is not the one posting these stupid one-line
>autobot requests. But feel free to e-mail him at bill@fccj.org so
>you can make him feel even worse about these stupid posts he has not
>been able to prevent.
Excuse me, but yes, he is the one who posted those requests. He has
been using my digest gateway to do it. He complained to the campus
admins that his mail to the gateway was being bounced as "no such host"
(sendmail "MAIL FROM host must exist" combined with NIS-only name
resolution), and after I told him I fixed the problem the first three
articles from him were the "send perl-users xxx" ones that appeared
here.
What I think he was trying to do was request them from my mailing list
manager, where those would be valid requests. This is a service that has
been available to the digest readers since I started running it. The
mailbox isn't even close to the same.
If he is saying he did not send these, then I will immediately block
the addresses from which they came, since someone is forging his
address and we certainly do not want that to happen. He has not
complained of this problem to me, however.
------------------------------
Date: Tue, 10 Aug 1999 00:19:09 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Simple write routine
Message-Id: <1eKr3.5206$rR.5058@nsw.nnrp.telstra.net>
In article <7on09a$m0n$1@nnrp1.deja.com>,
Stone Cold <paulm@dirigo.com> writes:
> Hello!
HI!
> Anyone have simple code that takes the current date and writes it out
> to a temp file? Any subroutine?
Sure. I don't know why you would want it, but here it is:
use strict;
use IO::File;
my $fh = IO::File->new_tmpfile() or die "Can't create temporary file: $!";
print $fh scalar localtime;
$fh->close;
> Any place where I can find this code?
Yes, in the documentation that comes with perl:
# perldoc IO::File
# perldoc -f open
# perldoc -f print
# perldoc -f localtime
# perldoc -f scalar
Martien
--
Martien Verbruggen |
Interactive Media Division | Unix is user friendly. It's just
Commercial Dynamics Pty. Ltd. | selective about its friends.
NSW, Australia |
------------------------------
Date: 10 Aug 1999 01:40:10 GMT
From: shou@logos.engr.sgi.com (Tom Shou)
Subject: system command syntax question
Message-Id: <7onvtq$hq4$1@murrow.corp.sgi.com>
Hi,
I want to do this command using the system command in perl on an NT system:
copy "my file name with spaces" file2
but if I do:
$tmp = "my file name with spaces";
$file1 = "\"" . $tmp . "\"";
system("copy $file1 $file2");
perl complains because $file1 has double-quotes in its name. How do I
make system view the double-quotes in $file1 as part of the string
name?
Thanks,
Tom
--
____________________________________________________________________
Tom Shou | shou@engr.sgi.com | SGI | 650.933.5362 | 650.932.5362 fax
http://reality.sgi.com/employees/shou_engr
------------------------------
Date: 10 Aug 1999 00:13:02 GMT
From: "Bart Simpson" <phony@nospam.com>
Subject: UpperCase first letter of string only.
Message-Id: <7onqqe$qvv$0@216.39.133.155>
my $mystring='hello';
How would I go about changing $mystring so it contains 'Hello'? I have a
script where names are entered, and would like to make sure the first letter
is capitalized.
--
Phony email address.
Reply to this newsgroup, not to email.
Thank you.
------------------------------
Date: Mon, 09 Aug 1999 20:43:08 -0400
From: brian@pm.org (brian d foy)
Subject: Re: UpperCase first letter of string only.
Message-Id: <brian-ya02408000R0908992043080001@news.panix.com>
In article <7onqqe$qvv$0@216.39.133.155>, "Bart Simpson" <phony@nospam.com> posted:
> my $mystring='hello';
>
> How would I go about changing $mystring so it contains 'Hello'? I have a
> script where names are entered, and would like to make sure the first letter
> is capitalized.
ucfirst() would work, even though it is cryptically named.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
Date: Mon, 09 Aug 1999 17:32:27 -0700
From: Makarand Kulkarni <makkulka@cisco.REMOVETHIS.com>
Subject: Re: UpperCase first letter of string only.
Message-Id: <37AF731B.1F55C8D9@cisco.REMOVETHIS.com>
[
Bart Simpson wrote:
> my $mystring='hello';
> How would I go about changing $mystring so it contains 'Hello'? I have a
> script where names are entered, and would like to make sure the first letter
> is capitalized.
]
use ucfirst ;
Recipe 1.9, Controlling Case. Perl CookBook.
--
------------------------------
Date: 10 Aug 1999 00:42:27 GMT
From: billynospam@mirror.bt.co.uk (Graham Ashton)
Subject: Re: UpperCase first letter of string only.
Message-Id: <slrn7qutbk.9j.billynospam@wing.mirror.bt.co.uk>
In article <brian-ya02408000R0908992043080001@news.panix.com>, brian d foy
wrote:
>ucfirst() would work, even though it is cryptically named.
or, if you wanted to uppercase the first character as a one off, you
could do;
$myvar = 'hello';
print "\u$myvar world.\n";
--
Graham
P.S. <billynospam@mirror.bt.co.uk> is a fully working address...
------------------------------
Date: Tue, 10 Aug 1999 01:49:39 GMT
From: marcel.grunauer@lovely.net (Marcel Grunauer)
Subject: Re: UpperCase first letter of string only.
Message-Id: <37b88527.23738323@enews.newsguy.com>
On 10 Aug 1999 00:13:02 GMT, "Bart Simpson" <phony@nospam.com> wrote:
>my $mystring='hello';
>
>How would I go about changing $mystring so it contains 'Hello'? I have a
>script where names are entered, and would like to make sure the first letter
>is capitalized.
perldoc -f ucfirst
Marcel
--
perl -e 'print unpack(q$u$,q$82G5S="!!;F]T:&5R(%!E<FP@2&%C:V5R$)'
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu.
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 437
*************************************