[11772] in Perl-Users-Digest
Perl-Users Digest, Issue: 5372 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 13 12:07:39 1999
Date: Tue, 13 Apr 99 09:00:21 -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 Tue, 13 Apr 1999 Volume: 8 Number: 5372
Today's topics:
Re: comparing arrays? (M.J.T. Guy)
Re: Creating an empty file. (Steve Linberg)
Re: Creating an empty file. (Bart Lateur)
Re: Creating an empty file. (Sam Holden)
Re: Delete Line Feed/Carriage Return <jshapir@uswest.com>
does this directory exist jewing@eng.utoledo.edu
Re: does this directory exist jewing@eng.utoledo.edu
Re: Examples of slow regexes? (was: Re: Perl regexps co (Abigail)
Re: Executing perl code from separate files (Steve Linberg)
Re: help needed on PERL CGI with apache (Steve Linberg)
Help: From Unix to NT <eckbert.dollhofer@at.siemens.de>
Re: How Should I begin Perl? <tchrist@mox.perl.com>
Re: How to write a format to an array instead of a file branboles@netscape.net
Re: How to write a format to an array instead of a file <tchrist@mox.perl.com>
Re: How to write a format to an array instead of a file (Larry Rosler)
Re: IIS4 and Perl - trying to get an ENV varibale that <paulfm@pdd.3com.com>
Re: implement useradd in perl (Randal L. Schwartz)
Novice needs learning suggestions m_stelly@my-dejanews.com
Re: Pragma docs <Jochen.Stenzel.gp@icn.siemens.de>
Re: Printing commas gtdgm@hotmail.com
Re: SQL using the ODBC module (Josi)
Re: String matching (Bart Lateur)
Re: Stripping out all but the first word <tchrist@mox.perl.com>
Re: stripping spaces out & LF/CR <tchrist@mox.perl.com>
Re: TPJ still shipping? (Tom Mornini)
Re: TPJ still shipping? <revjack@radix.net>
Re: Trouble with exec() and system() in CGI (Josi)
Re: Typeglobs broken by threaded perl??? (Bruce R Miller)
Re: Where we can get perl code snippets? <tchrist@mox.perl.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 13 Apr 1999 15:43:46 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: comparing arrays?
Message-Id: <7evoni$s92$1@pegasus.csx.cam.ac.uk>
Mathias Koerber <mathias@singnet.com.sg> wrote:
>
>I have several arrays containing strings. Is there an easy/fast
>way to compare these. The basic requirement here is to find out whether
>all arrays/contents agree, or if some contain less/more/other strings than
>others.
This is answered in perlfaq4:
How do I compute the difference of two arrays? How do I compute the intersection of two arrays?
Mike Guy
------------------------------
Date: Tue, 13 Apr 1999 11:10:26 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Creating an empty file.
Message-Id: <linberg-1304991110260001@ltl1.literacy.upenn.edu>
In article <3713505D.1EFF1652@orades.nl>, Steven Filipowicz
<s.filipowicz@orades.nl> wrote:
> Hi All,
>
> I have this line in a program :
>
>
------------------------------------------------------------------------------------
> open (GUEST,">/opt/guide/web/count.pl") || die "Can't Open
> /opt/guide/web/count.pl $!\n";
>
------------------------------------------------------------------------------------
>
> But if this file isn't there it will not open offcourse.
> So what I would like the program to do is, make the file, and set the
> permission to be able to write to it and then open it.
This works on my system:
open (FOO, '>bar.txt') or die "Can't open: $!";
print FOO "blah!\n";
close FOO or die "Can't close: $!";
Not sure what your difficulty is.
--
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>
------------------------------
Date: Tue, 13 Apr 1999 15:27:07 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Creating an empty file.
Message-Id: <3715623c.7698782@news.skynet.be>
Steven Filipowicz wrote:
>Does it automaticly create a file then?
Indeed, at least, if you have execute permissions on the directory (in
Unix). Write permissions alone is not enough, AFAIK.
Bart.
------------------------------
Date: 13 Apr 1999 15:39:00 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Creating an empty file.
Message-Id: <slrn7h6p8k.1uo.sholden@pgrad.cs.usyd.edu.au>
Steven Filipowicz <s.filipowicz@orades.nl> wrote:
>
>
>Sam Holden wrote:
>
>> Did you bother reading the documentation for the open function
>> (which specifically mentions what happens in the second paragraph)?
>Well, where can I find the documentation?
In the documentation for perl functions. The command quoted below should
work...
>
>
>> perldoc -f open
>
>Does it automaticly create a file then?
The documentation will tell you.
A simple test program will tell you...
--
Sam
I took the initiative in creating the Internet.
--Al Gore
------------------------------
Date: Tue, 13 Apr 1999 09:44:16 -0600
From: Jim Shapiro <jshapir@uswest.com>
Subject: Re: Delete Line Feed/Carriage Return
Message-Id: <37136650.95FF1F86@uswest.com>
markaw2091@my-dejanews.com wrote:
> Hi There,
>
> I have a Perl script (at foot of this message) which I am trying to use to
> remove all of the "complete comment line(s)" from a.n. other text file/perl
> script. That is to say that I want it to remove all lines which begin with a #
> and then go on to remove all blank lines (those which are made up of a line
> feed carriage return).
>
> I was under the impression that I could do this by making use of the s/^#.*//g
> and s/^$//mg. However, this does not seem to work. At least, the second part
> does not work. Any help would be greatly appreciated at
> mawilliams@walsh-international.com . FYI, here is the Perl script as it
> currently stands:
>
> print "Please enter the name of the file you wish to modify:\n";
> $modify = <STDIN>;
> $new = "./test.txt";
>
> open("fle", "$modify");
> open("new", "> $new");
>
> while (<fle>) {
> s/^#.*//g;
> s/^$//mg;
> print new "$_";
> }
>
> close "fle";
> close "new";
>
> Regards,
>
> -MAW-
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Something like this ought to do the job:
while(<FILE_HANDLE>) {
print unless substr($_, 0, 1) eq '#' or length($_) == 1;
}
--
Regards,
Jim Shapiro, Ph.D.
------------------------------
Date: Tue, 13 Apr 1999 11:38:51 -0400
From: jewing@eng.utoledo.edu
Subject: does this directory exist
Message-Id: <3713650B.4049509A@eng.utoledo.edu>
How can I check that a directory exists?
if my directory is $mDir/images
what should I use?
thanks,
John
------------------------------
Date: Tue, 13 Apr 1999 11:48:18 -0400
From: jewing@eng.utoledo.edu
Subject: Re: does this directory exist
Message-Id: <37136742.E49CE439@eng.utoledo.edu>
I found an answer, but if there is a shorter way could someone post it
please
John
#------------------------------------------------------------------
# This subroutin checks to see if the file past is a directory
# It returns 1 if it is and 0 if it is not.
#------------------------------------------------------------------
sub check_if_dir
{
local ($file_name) = @_;
open(infile, "$file_name") or &error_open_file($file_name);
local (@filedata) = stat(infile);
local ($file_type_mode) = $filedata[2];
local ($dir_flag)=0;
$dir_flag = 0;
if ($file_type_mode >= 16000 && $file_type_mode < 17000){
$dir_flag = 1;
}
return "$dir_flag";
}
------------------------------
Date: 13 Apr 1999 15:30:33 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Examples of slow regexes? (was: Re: Perl regexps compared to Python regexps)
Message-Id: <7evnup$l1d$1@client2.news.psi.net>
Bart Lateur (bart.lateur@skynet.be) wrote on MMLI September MCMXCIII in
<URL:news:37140971.1219499@news.skynet.be>:
^^
^^ What is a bit strange is that Perl's regex compiler doesn't even warn
^^ for the inefficiency, let alone optimize it. So: is it indeed *easy* for
^^ a regex compiler, to spot the possibility for simplification? How come
^^ this jumps into my face?
^^
^^ And are there examples of (very) inefficient regexes than CANNOT be
^^ simplified/optimized in this manner?
Try:
/a*b*a*c*a*d*a*e*a*f*a*g*a*b*a*c*a*d*a*e*a*f*a*g*a.c/
Of course, thing can be very complex, instead of repeating letters, you
have regexes that repeat subexpressions, and this isn't even bringing
backreferences.
I would be surprised if the halting problem isn't reducable to regex
"optimization".
Abigail
--
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi
------------------------------
Date: Tue, 13 Apr 1999 11:00:59 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Executing perl code from separate files
Message-Id: <linberg-1304991100590001@ltl1.literacy.upenn.edu>
In article <B337DCC496684ADFD2@204.112.166.88>, rlb@intrinsix.ca (Lee) wrote:
> If foo.pl is open to such mischief, would the script reading it not be
> equally vulnerable? Why would they have different permissions/owners? (I
> can imagine scenarios, but are they common?) Why such paranoia with do/eval
> and not with use/require?
>
> (curiosity, not flamebait)
Good point, and yes, it depends on the system and configuration. Assuming
*nix for this discussion, then many steps might be necessary to deem the
do'd or eval'd file trustworthy, and the script itself. If they have the
same permissions, then an enterprising hacker could go into the source
file and do whatever they want -- then again, with that kind of access,
they could just write their own scripts and be done with it, there
wouldn't be any particular need to hack an existing one.
The scenario I'm envisioning is more along the lines of a 755-permission
script reading a privately owned data file, where the owner could put
their own stuff in their data file and foo it with the script owned by
someone else. They could, of course, make their own copy of the script
and do things with it, but it would rely on the network of systems
permissions not to allow access to things they shouldn't have access to in
the first place.
Of course, this is all wild conjecture as far as the original poster goes
-- no idea what they were actually trying to achieve.
By going to a tokenized structure, you at least limit the verbs available
to the provider of the data file. Not complete security by any stretch,
but much better than blindly slurping in random perl and executing it.
--
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>
------------------------------
Date: Tue, 13 Apr 1999 11:07:47 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: help needed on PERL CGI with apache
Message-Id: <linberg-1304991107470001@ltl1.literacy.upenn.edu>
In article <37135531.322BE465@iutc3.unicaen.fr>, Xavier HEROULT
<heroux@iutc3.unicaen.fr> wrote:
> Then, I added just that line: "USE CGI;"
> and the famous "internal server error" appears.
Be sure to syntax-check your scripts before you try to run them (via 'perl
-c whatever.pl'). Perl is case-sensitive, and in this case, your "USE
CGI;" should simply be "use CGI;". It has nothing to do with your server.
Checking your scripts before giving them to the server to run will save
you many, many headaches, and CGI.pm is designed to allow you to pretend
you're running on a server for just this reason. Dig into the CGI.pm
documentation and have a good read.
--
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>
------------------------------
Date: Tue, 13 Apr 1999 17:36:36 +0200
From: Eckbert Dollhofer <eckbert.dollhofer@at.siemens.de>
Subject: Help: From Unix to NT
Message-Id: <37136484.21B0DB42@at.siemens.de>
Could anybody help me? I know how to run perl scripts (as CGI) on UNIX
but now I have to do the same on NT. I would like to know what changes
have to be made.
Is it correct to replace the line #!/usr/local/bin/perl by nameoffile.pl
?
When I use a path do I have to writ wwwroot/myname/nameoffile od do type
wwwroot\myname\nameoffile ?
and so on.
I would try this on my own but our firewall-team needs a lot of time to
install th files in the cgi-bin.
------------------------------
Date: 13 Apr 1999 09:11:00 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: How Should I begin Perl?
Message-Id: <37135e84@cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
WizeGuy@nettaxi.com writes:
:I have a book, but I don't get it. I NEED HELP!!!!!!!!!!!!!
Where the hell are my fries, kid?
--tom
--
Emacs is a fine programming language, but I still prefer perl. -me
------------------------------
Date: Tue, 13 Apr 1999 14:46:24 GMT
From: branboles@netscape.net
To: uri@home.sysarch.com
Subject: Re: How to write a format to an array instead of a filehandle?
Message-Id: <7evlbt$1n4$1@nnrp1.dejanews.com>
Yes, Uri, you are correct on my intentions. The program I am writing does not
involve any CGI stuff. I am just trying to manipulate a delimited file into a
fixed width file as well as a few other things.
Maybe I am attacking the problem from the wrong angle? What I need to do is
make each element of an array a fixed width field, while keeping each element
in its respective place in the array. To complicate things more, each
element (field) has to be a different fixed width. The reason I can't
immediately write to a filehandle and be done with it is because I need to
further manipulate the array once I use a format on it. Also, each time a
new array gets created by a 'for' loop in my program, it will have a
different number of elements each time. Clear as mud?
I have been looking at the formline command, and from the best I can figure
out, I will have to use a separate 'formline' for each element in my array
since each element is required to be a different width. Any other
suggestions?
Brandon Boles
branboles@netscape.net
In article <x7k8vhpd37.fsf@home.sysarch.com>,
Uri Guttman <uri@home.sysarch.com> wrote:
> >>>>> "DC" == David Cassell <cassell@mail.cor.epa.gov> writes:
>
> DC> branboles@netscape.net wrote:
> >>
> >> I am trying to use a format and write it to an array instead of it going
to
> >> standard output. I would like to do something like this:
> >>
> >> @newarray=write FORMAT;
> >>
> >> I don't want to use a temporary file, if I can get around it. Is there
any
> >> way to do this? Any help would be greatly appreciated! THANKS!
>
> DC> Umm, pardon my confusion, but why? Really, I'd like to know.
>
> i don't know his reasons but i could imagine some very easily. i tend to
> build strings before i print them so i can send them to multiple places.
>
> DC> write() sends output to a filehandle. It isn't designed for outputting
> DC> to a named array, which is *not* a filehandle.
>
> but the format stuff has a func called formline which does exactly what
> the poster wants. it formats to $^A. see perlform for more info.
>
> DC> If you're trying to set up tables on a website, this isn't the way
> DC> to go. Proportional fonts won't pay any attention to your
> DC> alignment.
>
> true but he didn't mention nor hint that this was a web related
> request. but format could be used on the web with some fixed font html
> like PRE, etc.
>
> uri
>
> --
> Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
> uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
> Have Perl, Will Travel ----------------------------- http://www.sysarch.com
> The Best Search Engine on the Net ------------- http://www.northernlight.com
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 13 Apr 1999 09:12:05 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: How to write a format to an array instead of a filehandle?
Message-Id: <37135ec5@cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
branboles@netscape.net writes:
:I am trying to use a format and write it to an array instead of it going to
:standard output.
Just convert my swrite() function in perlfunc(1) to an array thing
instead. Was it not obvious in the manpage?
--tom
--
I know I'm a pig-ignorant slut. --Andrew Hume
------------------------------
Date: Tue, 13 Apr 1999 08:34:31 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How to write a format to an array instead of a filehandle?
Message-Id: <MPG.117d03e516e0b6799898a5@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <7evlbt$1n4$1@nnrp1.dejanews.com> on Tue, 13 Apr 1999
14:46:24 GMT, branboles@netscape.net <branboles@netscape.net> says...
...
> I have been looking at the formline command, and from the best I can figure
> out, I will have to use a separate 'formline' for each element in my array
> since each element is required to be a different width. Any other
> suggestions?
The sprintf() function lets you specify the minimum width of an output
field. Here are some examples:
'%20s': Right-adjust a string in a 20-character field; pad with spaces.
'%-20s': Left-adjust a string in a 20-character field; pad with spaces.
'%5.3d': Right-adjust an integer, zero-padded to 3 digits, in a 5-
character field; pad with spaces.
No truncation occurs. If the data don't fit, the field is extended as
needed.
You can interpolate into the format: "%${d}s"
`perldoc -f sprintf`, and say goodbye to formats (unless you want to
produce page headers and footers, for example).
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 13 Apr 1999 16:22:45 +0100
From: Paul Murphy <paulfm@pdd.3com.com>
Subject: Re: IIS4 and Perl - trying to get an ENV varibale that worked under UNIX
Message-Id: <37136144.FBB3A18A@pdd.3com.com>
>I would ask this question in the comp.infosystems.www.servers.ms-windows
newsgroup
Cheers Jonathon - trying there.
TTFN
Paul
Jonathan Stowe wrote:
> Paul Murphy <paulfm@pdd.3com.com> wrote:
> >
> > We are intending to move our pages onto NT servers running IIS4, and
> > though I can get Perl running and working Ok on NT/IIS4 the environment
> > variable calls on NT IIS4 do not include the 'LAST_MODIFIED' element -
> > or if it does it doesn't work/ I can't find it!
> >
> > Any thoughts/ ideas/ code please? :-)
> >
>
> Yeah dont use IIS. Alternatively I would ask this question in the
> comp.infosystems.www.servers.ms-windows newsgroup because in the
> end of the day it is nothing to do with Perl - it is the server that
> providing the environment.
>
> /J\
> --
> Jonathan Stowe <jns@gellyfish.com>
------------------------------
Date: 13 Apr 1999 08:57:40 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: implement useradd in perl
Message-Id: <m13e247bt7.fsf@halfdome.holdit.com>
>>>>> "Rick" == Rick Delaney <rick.delaney@home.com> writes:
Rick> Uri Guttman wrote:
>>
>> i don't do any large sysadmin now but i would always have a
>> customized useradd program (which might call the system one for the
>> core features).
Rick> Which was my point. I had no idea that sysadmins were forced to write
Rick> useradd *completely* from scratch on some systems. Interesting.
And I never saw the need for a crutch like "useradd", except to
implement local policy (mail aliases here, standard .cshrc there). So
when people ask for "useradd", I tend to respond "Well, you'll need to
customize it almost entirely, so why are you asking for a stock one?"
It's like asking for a shell "echo" line that echoes what you want. :)
Just another guy who has been doing Unix admin for far too long,
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Tue, 13 Apr 1999 15:34:23 GMT
From: m_stelly@my-dejanews.com
Subject: Novice needs learning suggestions
Message-Id: <7evo5v$439$1@nnrp1.dejanews.com>
Hi all,
Where can a start-from-scratch CGI novice best learn quickly about using
PERL? I am familiar with other web languages, but I'm now itching to learn
how to get more power out of my pages.
All help is appreciated.
--
Michael Stelly
m_stelly@my-dejanews.com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 13 Apr 1999 17:18:46 +0200
From: "Hr. Jochen Stenzel" <Jochen.Stenzel.gp@icn.siemens.de>
Subject: Re: Pragma docs
Message-Id: <37136056.393A32C8@icn.siemens.de>
> >I'm searching for the docs about pragmas and think there was a website
> >anywhere about it, under "underdocumented features" or so. I cannot find
> >it again. Does somebody know where this pages are located? Or where I
> >can found ALL pragmas documented?
>
> 'perldoc perlmodlib' lists the pragmas.
> 'perldoc <pragma>' gives documentation on a particular pragma.
>
> I'm assuming perlmodlib lists 'ALL' pragmas, if not then I guess it is time
> to submit a bug report (although the wording doesn't say it lists all the
> pragmas).
Thanks for this, I searched the docs (even by "perldoc perl") but did not
found this. Unfortunately, perlmodlib seems to be incomplete. I know there is
a "fields" pragma which is not listet in perlmodlib ...
Nevertheless, thank you!
J. Stenzel
------------------------------
Date: Tue, 13 Apr 1999 15:14:00 GMT
From: gtdgm@hotmail.com
Subject: Re: Printing commas
Message-Id: <7evmvg$314$1@nnrp1.dejanews.com>
tadmc@metronet.com (Tad McClellan) wrote:
> Larry Rosler (lr@hpl.hp.com) wrote:
> : Greg Bacon <gbacon@itsc.uah.edu> says...
Thanks for the suggestions. I got my answer
and information.
-Godfrey Degamo
gtdgm@hotmail.com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 13 Apr 1999 15:07:47 GMT
From: j123ender123@gmx.net (Josi)
Subject: Re: SQL using the ODBC module
Message-Id: <37133326.3733318@news.active.ch>
On Tue, 13 Apr 1999 09:17:32 GMT, chatswood@my-dejanews.com
wrote:
>I've been experimenting with the ODBC module for a web-based project, and have
>However, my current objective is to use an "insert into" statement to append a
>new record to the database. The SQL query itself works from inside Access but
>doesn't seem to operate via the ODBC connection.
Error msg? Access permission?
I use Win32::ODBC for accessing SQL-Anywhere and MS-SQL
Databases. Calling stored procedures or 'insert into' isn't a
problem there. Maybe it is with Access :-)
cu, Josi
---
Ich mag kein spam!
bei Antwort per e-mail bitte "123" aus der adresse lvschen.
------------------------------
Date: Tue, 13 Apr 1999 15:24:41 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: String matching
Message-Id: <371460f4.7371429@news.skynet.be>
Ville Kemppinen wrote:
>What is the easiest way to check if 14. character in a string is
>for example D?
This question is insultingly simple. I bet you haven't got a clue about
the reall power of Perl, which goes far beyond what a simple answer to
this question would suggest. Therefore, I won't answer it. :-) Probably,
you're using a wrong approach to your REAL problem, anyway.
My advice: get some Perl scripts that do more or less what you want to
do. Try them. Disect them. Analyse them. Learn. And finally, look back
and lauch.
Bart.
------------------------------
Date: 13 Apr 1999 09:15:55 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Stripping out all but the first word
Message-Id: <37135fab@cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, Neil Sandow <rx@rxlist.com> writes:
:I have a variable in a perl script, $xbrand, that can be one or more
:words. When there are more than one word I would like it to
:be just the first word (i.e. Penicillin VK would become simply
:Penicillin)
What's a word? Is "what's" a word? What about "anal-retentive"?
What about "naove" and "fagade"?
Let's pretend we know what a word is.
$line =~ s/\s.*//;
or
($word = $line) =~ s/\s.*//;
or
($word) = $line =~ m/(\w+)/;
--tom
--
The use of COBOL criples the mind; its teaching should, therefore, be
regarded as a criminal offense. -- E. W. Dijkstra
------------------------------
Date: 13 Apr 1999 09:10:00 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: stripping spaces out & LF/CR
Message-Id: <37135e48@cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
markaw2091@my-dejanews.com writes:
:As an extension to this question I would like to ask you how you strip out all
:Blank Lines in a file. (That is to say all the lines which are line
:feed/Carriage Returns).
Please don't think of it that way. It's just newlines.
sed '/^$/d' < new > old
:FYI, i am using Perl on win32 (NT/98).
No, it's using you, and you have my pity. Your life
will be miserable.
I guess you'll have to run s2p on the above thing.
Or use
perl -ne 'print unless /^$/' < old > new
or better
perl -i.orig -ne 'print unless /^$/' file1 file2 file3
or even
perl -i.orig -ne 'print unless /^\s*$/' file1 file2 file3
--tom
--
Unix is like a toll road on which you have to stop every 50 feet to
pay another nickel. But hey! You only feel 5 cents poorer each time.
--Larry Wall in <1992Aug13.192357.15731@netlabs.com>
------------------------------
Date: Tue, 13 Apr 1999 15:01:14 GMT
From: tmornini@netcom.com (Tom Mornini)
Subject: Re: TPJ still shipping?
Message-Id: <tmorniniFA4v23.6D1@netcom.com>
Wappinger Mary (revjack@radix.net) wrote:
: Is The Perl Journal still shipping? I ordered a year's subscription and
: all the back issues almost a month ago, and I have yet to receive them.
: Mail to Mr. Orwant doesn't seem to be getting me anywhere.
I received the current issue mid-last-week.
: Has anyone else successfully purchased TPJ?
Well, no. :-) I'm a printer and don't want to own a magazine business.
However, my subscription purchase was very successful!
-- Tom Mornini
-- InfoMania
------------------------------
Date: 13 Apr 1999 15:09:49 GMT
From: Mackey Hamilton <revjack@radix.net>
Subject: Re: TPJ still shipping?
Message-Id: <7evmnt$pv6$1@news1.Radix.Net>
Keywords: Hexapodia as the key insight
Tom Mornini explains it all:
:Wappinger Mary (revjack@radix.net) wrote:
:: Has anyone else successfully purchased TPJ?
:Well, no. :-) I'm a printer and don't want to own a magazine business.
:However, my subscription purchase was very successful!
Well, there go my takeover plans. Guess I'll have to tell Mr. Ballmer that
MS-Perl isn't going to happen this month.
--
/~\ Milwaukee gabardine caryatid dissociable Haddad strabismus seer
C oo instead veldt subtlety incestuous interfere waxy harvest Sevill
_( ^) 1 , 0 0 0 , 0 0 0 m o n k e y s c a n ' t b e w r o n g
/___~\ http://3509641275/~revjack 04/13/99 11:09:50 revjack@radix.net
------------------------------
Date: Tue, 13 Apr 1999 15:07:48 GMT
From: j123ender123@gmx.net (Josi)
Subject: Re: Trouble with exec() and system() in CGI
Message-Id: <37133592.4353039@news.active.ch>
On Tue, 13 Apr 1999 07:25:23 GMT, ajeet@my-dejanews.com wrote:
>script. But, whenever I run the script file on the server using:
>exec("del $filename"); or system("del $filename"); or unlink(<$filename>);
>It doesnt work as long as it is inside the "Content type" header of CGI
>But, when I run it from the command line, it performs the system function.
>Why is that so??? Any idea anybody?
Sounds like NT? doesn't it? Maybe your webserver (wich starts the
CGI) does not have the necessary access privilege.
cu, Josi
---
Ich mag kein spam!
bei Antwort per e-mail bitte "123" aus der adresse lvschen.
------------------------------
Date: 13 Apr 1999 14:57:52 GMT
From: bruce.miller@nist.gov (Bruce R Miller)
Subject: Re: Typeglobs broken by threaded perl???
Message-Id: <7evm1g$lrg$1@news.nist.gov>
In article <7evjv5$rk0$1@nntp.stanford.edu>,
<bbense+comp.lang.perl.misc.Apr.13.99@telemark.stanford.edu> ; writes:
>In article <7eiha8$3fq$1@news.nist.gov>,
>...
>>But any reusable piece of code that mungs with $_, either has to bind it,
>>or advertise it, anyway... threads or no.
>
>- - I think there is a problem with the statement
>
>"But any reusable piece of code that mungs with $_"
>
>It's pretty much an oxymoron in my book. Reusable code
>does not mung with $_.
You go a bit further than I would, but I think we agree in the general
sentiment...
Which still leaves the question: What's the change in treatment of $_
supposed to be saving us from?
>- - I regret posting this already...
As well you should ! :>
--
--
bruce.miller@nist.gov
http://math.nist.gov/~BMiller/
------------------------------
Date: 13 Apr 1999 09:22:27 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Where we can get perl code snippets?
Message-Id: <37136133@cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
=?euc-kr?B?udrBvrq5IChQYXJrLCBKb25nLVBvcmsp?= <okclub@communitech.net> writes:
:Where is perl code snippets??
Pelr examples are found at:
ftp://ftp.oreilly.com/published/oreilly/perl/cookbook/
http://language.perl.com/ppt/
http://www.perl.com/CPAN-local/authors/id/TOMC/scripts/
--tom
--
/* we have tried to make this normal case as abnormal as possible */
--Larry Wall in cmd.c from the perl source code
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 5372
**************************************