[8356] in Perl-Users-Digest
Perl-Users Digest, Issue: 1973 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 25 16:13:50 1998
Date: Wed, 25 Feb 98 13:00:25 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 25 Feb 1998 Volume: 8 Number: 1973
Today's topics:
Re: CGI.pm a part of Perl (was Re: Cookies) <jdporter@min.net>
Re: Easy way to "clean" an array (Anthony Veale')
Re: Easy way to "clean" an array (John Klassa)
Re: Easy way to "clean" an array (Gabor)
Re: HELP array stuff <tlcountr@collins.rockwell.com>
Help with SYSTEM command? <mcdonald@aesop.rutgers.edu>
HELP: Perl and Msql DBI (Keith Ruskin)
Re: How do I create my own perl libraries? (steve)
Re: How do I create my own perl libraries? (Martin Vorlaender)
ICQ within a PERL <adamallen@@@mail-me.com>
Re: Idea for New Perl Global Variable <tchrist@mox.perl.com>
Re: indirect object syntax (O'Shaughnessy Evans)
Re: Newbie + Databases <jdporter@min.net>
Re: Off-topic (Sorry, but I need your help) <jdporter@min.net>
Re: Philisophical Response? Perl5/oop <jdporter@min.net>
Please Tell me:- Differences of Linux and NT. <adamallen@@@mail-me.com>
Re: Please Tell me:- Differences of Linux and NT. (Jack Ostroff)
Re: Please Tell me:- Differences of Linux and NT. scott@softbase.com
Re: Prisoners of the evil empire <jdporter@min.net>
Re: proper filename extensions (steve)
Re: proper filename extensions <joneil@cks.ssd.k12.wa.us>
Splitting on 2 line feeds? kperrier@neosoft.com
Re: Stripping linefeeds (Craig Berry)
Re: Stripping linefeeds (Gabor)
Re: The Ineffable Tom C. (Sean Ahern)
Re: The Ineffable Tom C. (Sean Ahern)
Re: Using strings as filehandles <doug@weboneinc.net>
Re: Why install perl? <barnett@houston.Geco-Prakla.slb.com>
Re: why no Case statment? <jdporter@min.net>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 25 Feb 1998 15:46:57 -0500
From: John Porter <jdporter@min.net>
Subject: Re: CGI.pm a part of Perl (was Re: Cookies)
Message-Id: <34F48341.28E1@min.net>
uri@sysarch.com wrote:
>
> John Porter <jdporter@min.net> writes:
>
> > $.02:
> > perl is the language and the interpreter for that language;
> ^^^^^^^^
> this is Perl too. only the interpreter is perl (the actual command you
> enter), almost all else is Perl.
Just what I said. -- although I didn't say perl is part of Perl;
I thought that was understood.
> > Perl is the distribution and the culture.
> > Ergo, some modules are 100% perl, some are partly C.
> > Some modules are part of Perl, some aren't.
>
> also like libc is NOT C, but is always assumed,
I totally agree with you here.
> the standard Perl
> modules and pragmas are NOT Perl but assumed to be there.
Nah, I propose that Perl (uc) is the full distribution, while
perl (lc) is the interpreter and the language being interpreted.
John Porter
------------------------------
Date: 25 Feb 1998 18:57:13 GMT
From: veale@Colorado.EDU (Anthony Veale')
Subject: Re: Easy way to "clean" an array
Message-Id: <6d1pi9$lm7@lace.colorado.edu>
joe.mcmahon@gsfc.nasa.gov (Joe McMahon) writes:
>In article <34F4336B.141C@schweiz.org>, Schwitter Ruedi
><Ruedi.Schwitter@schweiz.org> wrote:
>>I have a sorted array with duplicated entrys, like
>>
>>006621
>>006621
>>006622
>>006623
>>006623
>>006623
>>006624 usf.
>>
>>Witch is the easiest way to check out the duplicated entrys ?
>One way to do it:
>sub killdups {
> my (@withdups) = @_;
> my $last = undef;
> my @clean = ();
> foreach my $current (@withdups) {
> next if $last eq $current;
> push @clean, $last if defined($last);
> $last = $current;
> }
> push @clean, $last if $clean[$#clean] ne $last;
> return @clean;
>}
>I'm sure there are more compact ways to do it, but this works.
Based on the examples in the Programming perl first edition I use
this. I've never gone back to work out the issues of 'local' versus
'my' scope in perl 5.
local(%MARK);
grep($MARK{$_}++,@ARRAY);
@ARRAY = keys %MARK;
You could toss in a 'sort' before the 'keys' if that matters. And you
don't need to sort first if you are going to.
As a bonus, the values in %MARK count the duplicates if that happens
to interest you.
--
Anthony Veale' (303)492-0851 veale@casa.colorado.edu
Paging: (303)441-0713 veale-page@casa.colorado.edu
Professional Research Assistant (System Manager Assistant)
Center for Astrophysics and Space Astronomy
------------------------------
Date: 25 Feb 1998 19:44:29 GMT
From: klassa@aursgh.aur.alcatel.com (John Klassa)
Subject: Re: Easy way to "clean" an array
Message-Id: <6d1sat$4j6$1@aurwww.aur.alcatel.com>
On Wed, 25 Feb 1998 12:57:55 -0500, Joe McMahon wrote:
->In article <34F4336B.141C@schweiz.org>, Schwitter Ruedi
-><Ruedi.Schwitter@schweiz.org> wrote:
->
-> [ problem description, having to do with removing duplicate elements
-> in any array, deleted ]
->
-> [ Joe's algorithm deleted ]
->
->I'm sure there are more compact ways to do it, but this works.
Indeed... See perlfaq4 for a variety of answers to this very question.
--
John Klassa / Alcatel Telecom / Raleigh, NC, USA <><
------------------------------
Date: 25 Feb 1998 20:13:12 GMT
From: gabor@vmunix.com (Gabor)
Subject: Re: Easy way to "clean" an array
Message-Id: <slrn6f8vbf.8f0.gabor@vnode.vmunix.com>
In comp.lang.perl.misc, Schwitter Ruedi <Ruedi.Schwitter@schweiz.org> wrote :
# Hi
#
# I have a sorted array with duplicated entrys, like
#
# 006621
# 006621
# 006622
# 006623
# 006623
# 006623
# 006624 usf.
#
# Witch is the easiest way to check out the duplicated entrys ?
assuming your numbers are in an array called @foo
@tmp{@foo}=@foo;
@foo=sort keys %tmp;
gabor.
--
Sorry. My testing organization is either too small, or too large,
depending on how you look at it. :-)
-- Larry Wall in <1991Apr22.175438.8564@jpl-devvax.jpl.nasa.gov>
------------------------------
Date: Tue, 24 Feb 1998 16:32:49 -0600
From: Tim Countryman <tlcountr@collins.rockwell.com>
To: Douglas Cordero <dcordero@giss.nasa.gov>
Subject: Re: HELP array stuff
Message-Id: <34F34A91.6F0CB71E@collins.rockwell.com>
This works for me - if I substitute @array2 for @prodata in
the 'foreach'
HTH
--Tim Countryman--
No fancy sig
Douglas Cordero wrote:
>
> Hi!
> I am going crazy with this one.
> I have 2 arrays:
> @array1 @array2
> 1234.4 GHI.92.2345.0.92
> 2345.0 DEF.91.0298.2.91
> 0298.2 ABC.89.1234.4.89
>
> 1) Normally, they should be the same size.
> 2) The contents of @array1 should be somewhere in @array2.
> 3) If the contents of @array1 aren't in @array2, alert user.
>
> I came up with this, but it doesn't work:
>
> foreach $A1 (@array1) {
> $found = 0;
> foreach (@prodata) {
> if (m/$A/) {
> $found = 1;
> last;
> }
> }
> if( $found == 0 )
> { die "MISSING DATA\n" }
> }
>
> Any ideas where I am screwing this rather easy task up?
>
> Thx.
> Doug C.
------------------------------
Date: Wed, 25 Feb 1998 15:39:25 -0500
From: "James R. McDonald" <mcdonald@aesop.rutgers.edu>
Subject: Help with SYSTEM command?
Message-Id: <34F4817D.EBBF5D2C@aesop.rutgers.edu>
I'm working on a PERL program on VMS and one of the things
I'd like the program to be capable of is to copy a file.
I have the new file name as a variable, ie $newfile and
I figured on using the system command to do it, but instead
the program is copying the file and naming it $newfile.
ie:
$newfile=newdata.txt;
system('copy oldfile.txt $newfile');
How can I get PERL (or VMS) to interpret the string $newfile
when doing the copy command?
Thanks in advance,
Jim McDonald
------------------------------
Date: 25 Feb 1998 20:19:19 GMT
From: ruskin@groucho.med.yale.edu (Keith Ruskin)
Subject: HELP: Perl and Msql DBI
Message-Id: <6d1uc7$att$1@news.ycc.yale.edu>
Hi, all. I'm wondering if someone can help me spot a (probably
obvious) problem with calling DBD:mSQL from perl. This program
compiles just fine, and the first query is successful. When it tries
to do the second query, it dies with this error:
Can't call method "fetchhash" without a package or object reference at
/home/httpd/cgi-bin/vlsubmit line 69.
Line 69 is the second query in the code below. Am I missing something
obvious here? Any help would be appreciated.
Here are the relevant sections of code:
# load the cgi library
require "/usr/local/lib/cgi-lib.pl";
# Msql datbase interface library
use Msql;
# First, connect to database server
$hostname = "";
$databasename = "www-vl";
my $dbh = Msql->connect($hostname,$databasename);
##### Stuff Deleted #####
# Check for repeat submissions (First query)
$Query = "select SHORTDESC from HOTLIST where URL = '$URL'";
my $sth = $dbh->query ($Query);
%row = $sth->fetchhash;
&repeat_sub if (%row);
# Now get the next UID... (Second query)
$Query = "select MaxUID from UIDs where TableName = 'SUBMISSIONS'";
$sth = $dbh->query($Query);
%row = $sth->fetchhash;
$MaxUID = $row{'MaxUID'} + 1; # Increment by one and save for next time
$Query = "Update UIDs Set MaxUID = '$MaxUID' where TableName = 'SUBMISSIONS'";
$sth = $dbh->query($Query);
##### More stuff deleted #####
- Keith Ruskin
Yale University School of Medicine
GASNet: http://gasnet.med.yale.edu
------------------------------
Date: Wed, 25 Feb 1998 20:27:13 GMT
From: me@here.com (steve)
Subject: Re: How do I create my own perl libraries?
Message-Id: <34f87e79.106252067@news.cent.com>
To create a library you need some good bookshelves. Home depot has
some good prices on lumber if you want to make them yourself.
But seriously,
To use another file as a template so to speak you use "Require" as in
require "mytemplatescript.pl"; then call to any subs etc. you need
from that script. also, add 1; as the last text of the
template script so that it returns 'true'.
On Wed, 25 Feb 1998 03:14:08 -0800, Joey Garcia <bear@pacificnet.net>
wrote:
>Hello, I'm sort of new but I'm getting the hang of everything here
>pretty quickly. I've written a few working cgi scripts and I keep
>coming up with more. The problem I have is that I use alot of the same
>code in each one. I wanted to know if there was a way I can make my own
>perl libraries or modules that I can include into the actual perl
>execuables. Also, can I run my personal libraries from the same
>directory that contain the cgi programs? Thanks for the help.
>
> Joey Bear Garcia
>
------------------------------
Date: Wed, 25 Feb 1998 21:11:27 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: How do I create my own perl libraries?
Message-Id: <34f47aef.524144494f47414741@radiogaga.harz.de>
Joey Garcia (bear@pacificnet.net) wrote:
: Hello, I'm sort of new but I'm getting the hang of everything here
: pretty quickly. I've written a few working cgi scripts and I keep
: coming up with more. The problem I have is that I use alot of the same
: code in each one. I wanted to know if there was a way I can make my own
: perl libraries or modules that I can include into the actual perl
: execuables.
Sure. Read all about modules in the perlmod and perlmodlib PODs, and the
Exporter POD for techniques on how to export names from modules.
: Also, can I run my personal libraries from the same
: directory that contain the cgi programs?
To include directories into @INC: 'use lib'. The incantation for what
you want to do is
use FindBin;
use lib $FindBin::RealBin;
use my-module-in-the-same-path-as-the-perl-script;
This was discussed in a recent thread titled "use lib relative pathnames"
in comp.lang.perl.modules.
cu,
Martin
--
| Martin Vorlaender | VMS & WNT programmer
Ceterum censeo | work: mv@pdv-systeme.de
Redmondem delendam esse. | http://www.pdv-systeme.de/users/martinv/
| home: martin@radiogaga.harz.de
------------------------------
Date: Wed, 25 Feb 1998 10:42:15 -0000
From: "Mr. Adam ALLEN." <adamallen@@@mail-me.com>
Subject: ICQ within a PERL
Message-Id: <6d1pqv$r6$2@news.enterprise.net>
Is there anyway of sending a message to an ICQ number from within a perl,
and then getting back confirmation that the ICQ was actually on-line.
------------------------------
Date: 25 Feb 1998 18:56:55 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Idea for New Perl Global Variable
Message-Id: <6d1phn$sko$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, Phillip Lenhardt <philen@ans.net> writes:
:Working on error-checking in a module of mine, I realized how much time I
:was spending figuring out which subroutine and which package I was
:currently in so that my error messages would be more helpful. How about a
:new global variable to do just that? It could be $} or something. If this
:is really stupid or uninformed, flame me; but keep it off the newsgroup.
__PACKAGE__ is the current package
But this may be more of what you want:
sub whowasi { (caller(2))[3] }
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
"Just because you're screwed *up* doesn't mean your screwed." --Larry Wall
------------------------------
Date: 25 Feb 1998 19:32:59 GMT
From: shaug@gromit.callamer.com (O'Shaughnessy Evans)
Subject: Re: indirect object syntax
Message-Id: <6d1rlb$hbi$1@ha1.rdc1.occa.home.com>
In article <34F354C3.54BF@netvision.net.il>,
Tzadik Vanderhoof <stvhoof@netvision.net.il> wrote:
>
>I am using CGI.pm. I have a line that says
>
>$foo = $cgi->param('bar');
>
>It works fine. Just as an experiment to increase my understanding of
>using objects in Perl, I tried changing it to:
>
>$foo = param $cgi 'bar';
>
>This caused a syntax error. Why is this? Aren't "object-oriented" and
>"direct object" syntax supposed to do the same thing?
Just like Gabor mentioned, you need to qualify param(). Since it's
not in the main namespace by default, you have to use ``CGI::param''
instead. You may find some useful info on this by lookup up the
"use" pragma, @EXPORT, @EXPORT_OK, and even the docs for CGI.pm.
Also, I think that if you try something like ``use CGI qw(param)''
instead of simply ``use CGI'', you won't have to qualify that
function.
Regards.
--
- O'Shaughnessy Evans
- http://www.callamerica.net/shaug/
------------------------------
Date: Wed, 25 Feb 1998 13:59:19 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Newbie + Databases
Message-Id: <34F46A07.39A6@min.net>
Clay Irving wrote:
>
> Here's one way -- Make the value a string you can split later:
>
> $hash{$key} = "value1|value2|value3|value4|value5";
This is on its way toward being a FAQ.
Clay's suggestion works for a "single-level" records, i.e. one
where all the fields are printable values. If the records are
nested data structures in any way, you'll need something more.
I've been using the MLDBM module, which uses the Data::Dumper
module to "flatten" your data structures before storing them
in the dbm. Give it a try.
hth,
John Porter
------------------------------
Date: Wed, 25 Feb 1998 14:06:03 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Off-topic (Sorry, but I need your help)
Message-Id: <34F46B9B.541F@min.net>
Allie wrote:
>
> I know this off-topic and I apologize, but I've been
> really impressed with the knowledge and helpfulness of
> the people in this NG and I thought you might be able
> to help.
"Bummer of a birthmark, Hal." -- GL:FS
John Porter
------------------------------
Date: Wed, 25 Feb 1998 15:02:19 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Philisophical Response? Perl5/oop
Message-Id: <34F478CB.2AF5@min.net>
Earl Hood wrote:
>
> OO has great uses, but it is not the end-all, be-all on how to do
> things.
Blast you, infidel.
The only thing Perl says about how to do things is to give you
more than one way. And this, as a linguistic philosophy, is
our sine qua non.
John Porter
------------------------------
Date: Wed, 25 Feb 1998 10:41:24 -0000
From: "Mr. Adam ALLEN." <adamallen@@@mail-me.com>
Subject: Please Tell me:- Differences of Linux and NT.
Message-Id: <6d1pqh$r6$1@news.enterprise.net>
I currently use NT for my scripts, what's the difference between Linux and
NT?
Does Linux have filepermissions like Unix, and if writing a text file in a
perl does it need to have permssions set, and how would you do it?
Are there anyother differences which would stop a perl working?
Adam Allen
adamallen@mail-me.com
------------------------------
Date: 25 Feb 1998 19:17:04 GMT
From: ostroj@gsun150.pfizer.com (Jack Ostroff)
Subject: Re: Please Tell me:- Differences of Linux and NT.
Message-Id: <6d1qng$1c52@mascagni.pfizer.com>
In article <6d1pqh$r6$1@news.enterprise.net>, "Mr. Adam ALLEN." <adamallen@@@mail-me.com> writes:
> I currently use NT for my scripts, what's the difference between Linux and
> NT?
>
> Does Linux have filepermissions like Unix, and if writing a text file in a
> perl does it need to have permssions set, and how would you do it?
> Are there anyother differences which would stop a perl working?
>
> Adam Allen
> adamallen@mail-me.com
>
>
Linux has lots of stuff like unix, including file permissions.
I'm not sure what your question is? For perl to create a file it
needs write permissions to the directory in which it is creating.
To write to a file, it needs write permissions on the file. If
you are wondering about setting the permissions on a file, check
the copious Perl documentation for umask and chmod.
What are you really asking? If perl isn't working, you should be
getting an error from the operating system. If it is not working
correctly, you should be getting an error message (or several)
from the operating system or from perl. If it is working, but
not how you expect it to - that is a different story. In all
cases, if you want help here, you will need to provide more
information.
------------------------------
Date: 25 Feb 1998 19:27:41 GMT
From: scott@softbase.com
Subject: Re: Please Tell me:- Differences of Linux and NT.
Message-Id: <6d1rbd$kg9$1@mainsrv.main.nc.us>
Mr. Adam ALLEN. (adamallen@@@mail-me.com) wrote:
> I currently use NT for my scripts, what's the difference
> between Linux and NT?
Going from NT -> UNIX would not be bad. The reverse is much worse
since NT is a warmed over VMS and does not use UNIX-like process
concepts. Porting Perl code that works on NT to UNIX would be
much easier than the reverse...
> Are there anyother differences which would stop a perl working?
... unless you used some Win32:: or OLE modules. Then you'd
have to recode this stuff in terms UNIX would understand.
For some things like using Automation controllers, there
would be no equivalent.
If you don't *know* UNIX, I would not try to learn UNIX by
porting a Perl program. That's asking for it. Learn your
way around UNIX first.
Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more.
------------------------------
Date: Wed, 25 Feb 1998 15:04:49 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Prisoners of the evil empire
Message-Id: <34F47961.6FE0@min.net>
Matthew Pryor wrote:
>
> Can someone tell me what a Prisoner of the Evil Empire actually is?
Why, none other than the empire ruled by Bill "Sauron" Gates.
John Porter
------------------------------
Date: Wed, 25 Feb 1998 20:21:19 GMT
From: me@here.com (steve)
Subject: Re: proper filename extensions
Message-Id: <34f67d04.105878214@news.cent.com>
I think,
Unless your Web server requires a specific extension you can use
anything, myscript.mywifehasabigbelly
On Tue, 24 Feb 1998 22:36:34 -0500, "Charles E. Burleson"
<walrus@qis.net> wrote:
> I would like to know the proper extensions to use for a perl
>script. In the past I have named mine "something.pl", and as far as I knew
>that was the correct extension for my programs. The other night on Efnet
>in the #perl channel I saw that was not the proper way, and that only the
>clueless use this.(I am obviously clueless)
> I have been reading through the faq's and could not find anything
>to tell me what type files have what extensions. Also visited several web
>pages with tutorials which also used the .pl extension. In the "Advanced
>Perl Programming" book were also examples with .pl extensions. Would
>someone please tell me what the proper file extensions are, and what they
>are for so I could think of myself as less clueless?
>
>
>******************************************************************************
> Chuck Burleson
> visit me at http://www.qis.net/~walrus/index.shtml
> walrus@qis.net
>******************************************************************************
>
------------------------------
Date: Wed, 25 Feb 1998 12:46:55 -0800
From: Jerome O'Neil <joneil@cks.ssd.k12.wa.us>
To: walrus@qis.net
Subject: Re: proper filename extensions
Message-Id: <34F4833F.FCCF2BA3@cks.ssd.k12.wa.us>
> I have been reading through the faq's and could not find anything
> to tell me what type files have what extensions. Also visited several web
> pages with tutorials which also used the .pl extension. In the "Advanced
> Perl Programming" book were also examples with .pl extensions. Would
> someone please tell me what the proper file extensions are, and what they
> are for so I could think of myself as less clueless?
>
The proper extention is .anythingyoulike or *nothingatall on most unix like
systems. WinTel platforms may vary.
Jerome "Dot SEE OH EMM" O'Neil
.
------------------------------
Date: Wed, 25 Feb 1998 14:06:52 -0600
From: kperrier@neosoft.com
Subject: Splitting on 2 line feeds?
Message-Id: <6d1tkr$omn$1@nnrp1.dejanews.com>
I am writing a script that will read in the output of a command and check
some of the outputs for various things. The input will look like this:
root:
id=0
home=/
shell=/bin/ksh
time_last_login=887901535
time_last_unsuccessful_login=876517157
[more info like this]
.
.
.
rss=65536
kent:
id=200
home=/home/kent
[etc. I think you get the idea]
What I want the script to do (btw perl 5.004_4 on AIX 4.1.4) is read in the
output of the lsuser command (it gives output in the format above) and in each
element of the array have each users information, i.e. I want to split on the
two /n characters that separate the records.
I have used DejaNews (which I posting from as the nazis at work will not
allow usenet access from work) to search the news group with out luck. I have
looked at the perlre page and the faq. Here is my code so far, which doesn't
do what I want it to do:
<PERL SOURCE>
#!/usr/local/bin/perl5 -w
#
# This script will parce the output of the lsuser -f ALL command to see
# whose passwords have expired, whose accounts are locked and for how long.
#
# Users whose accounts have been locked due to their password expiring will
# be pointed out explicitly and the number of days until the account is
# removed will be displayed.
#
# Kent Perrier 20Feb1998
#
use strict; # I must declaire my variable names.
#
open (SOURCE,"/home/kent/lsuser.out") or die "Cannot open /home/kent/lsuse
r.out: $!";
# For testing I have put the output of the lsuser -F ALL command into this
# file.
my (@DATA) = <SOURCE>;
my (@CHUNKS) = split (/\n\n/, @DATA);
my ($CHUNKS) = @CHUNKS;
print "$DATA[0]";
print "The next element is:\n";
print "$DATA[1]";
print "@CHUNKS\n";
print "$CHUNKS\n";
close (SOURCE) || die "Can't close /home/kent/lsuser.out! $!";
</PERL SOURCE>
The print statments are for debugging (of course) and here is the output:
<PERL OUTPUT>
/home/kent/src> chkuser
root:
The next element is:
id=0
2808
2808
/home/kent/src>
</PERL OUTPUT>
If you can help please do so. If you want to flame me for not reading
the excellent documentation that came with me perl distribution please
do so via private email (regardless of what you might think I did read
the documentation, I just couldn't find anything that I thought would
help me where I looked). I you do email me send it to either
kperrier@neosoft.com(play) or kent.perrier@chase.com (work).
Thanks,
Kent
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 25 Feb 1998 19:06:18 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Stripping linefeeds
Message-Id: <6d1q3a$20n$1@marina.cinenet.net>
Norman Bunn (norman.bunn@mci.com) wrote:
: I'm reading in a colon delimited file as follows:
[snip]
: My problem is that each entry has a linefeed at the end, so instead of:
[snip]
: Any help on removing the LF?
perldoc -f chomp
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: 25 Feb 1998 20:05:34 GMT
From: gabor@vmunix.com (Gabor)
Subject: Re: Stripping linefeeds
Message-Id: <slrn6f8ut5.8f0.gabor@vnode.vmunix.com>
In comp.lang.perl.misc, Norman Bunn <norman.bunn@mci.com> wrote :
# I'm reading in a colon delimited file as follows:
# Doe:John
# Smith:Joan
# etc.
# I'm splitting the file into an array, reversing the order and adding a
# domain address (@mci.com) to each one. This, obviously, creates an e-mail
# address.
# My problem is that each entry has a linefeed at the end, so instead of:
# John.Doe@mci.com
# I'm getting:
# John
# .Doe@mci.com
# Any help on removing the LF?
chomp() removes any line ending correspong to the value of $/
chop() removes the last character from the line
------------------------------
Date: Wed, 25 Feb 1998 19:31:03 GMT
From: wrdcom@clara.net (Sean Ahern)
Subject: Re: The Ineffable Tom C.
Message-Id: <34f47135.9387451@news.clara.net>
On 25 Feb 1998 03:36:08 GMT, mgjv@comdyn.com.au (Martien Verbruggen)
wrote:
>whose? And the term 'elitism' in this context is just a term used by
>people who are jealous of other people's accomplishments.
Erm, exactly whose accomplishments am I supposed to be jealous
of?
Sean
The Once, and Future,
White Rabbit
------------------------------
Date: Wed, 25 Feb 1998 19:36:05 GMT
From: wrdcom@clara.net (Sean Ahern)
Subject: Re: The Ineffable Tom C.
Message-Id: <34f471f9.9584078@news.clara.net>
On 25 Feb 1998 11:43:14 +0000, James Gillespie
<jim.gillespie@ssmb.com> wrote:
> Hmmm, my copy doesn't have a page xxvii. Page xv has a bit about
>usenet groups though. Maybe you meant the bit which says: "Like Perl
>itself, comp.lang.perl.misc is meant to be useful, and no question is
>too silly to ask(*)."
>
I repeat, 2nd Edition. Where the portion you mention is on
page xx.
> The asterisk is a typesetting convention meaning, "look at the
>bottom of the page for a footnote."
Is it? Oh silly me. Gee, I should I have tried the
typesetters newsgroup?
In this case, the footnote reads:
>"(*) Of course, some questions are too silly to answer, especially
>those already answered in the FAQ."
Sean
The Once, and Future,
White Rabbit
------------------------------
Date: Wed, 25 Feb 1998 13:49:19 -0500
From: Douglas Clifton <doug@weboneinc.net>
Subject: Re: Using strings as filehandles
Message-Id: <34F467AF.14DB654@weboneinc.net>
Luis J. Martinez wrote:
>
> Is there a way to use very large strings as files?
Could you be any more vague?
--
Douglas Clifton
Unix/C/Perl/CGI/HTML Programmer
doug@weboneinc.net
------------------------------
Date: Wed, 25 Feb 1998 12:35:43 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: Why install perl?
Message-Id: <34F4647F.1DC88974@houston.Geco-Prakla.slb.com>
Hansen wrote:
>
> Hello
>
> I am just beginning to learn perl. I did not see in the text I've been
> using (Gundavaram's CGI Programming on the WWW) that I need to install
> perl on my system. I find that the online tutorial that I'm going
> through says that I need to install it.
>
That all depends on what you want to do.
> I am trying to learn this cgi scripting tool in order to develop forms
> for several pages I've developed or maintain. I work from my home PC
> and ftp my stuff to the campus server.
>
> The scripts I've been playing around with have been written on MSWord,
> saved as text, and ftp'd to the server. I then test them with Netscape.
>
So, you apparently have a web server set up that understands, and likes
perl cgi scripts.
> Would installing it allow me to test the scripts without ftp-ing?
>
Partially. You would need:
1. Perl for win32 systems (There are at least 2 ports to windoze, one
by Activestate, and one by Guruthy
Suranamy(spelling??--don't have any reference in front of me no...)
)
2. Some form of httpd process (web server software). The browser does
not run the script, the web server does,
then passes it to the browser for display.
3. In lieu of 2, you could use the CGI.pm module, and test the script
in offline mode, without using either a
broswer, or a web server.
Once those are set up, you should be able to test your cgi scripts,
assuming they don't need OS specific stuff that you don't have access to
(ie unix system calls on a windoze pc).
> Victoria
Good luck.
Dave
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
------------------------------------------------------------------------
* Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------
------------------------------
Date: Wed, 25 Feb 1998 15:40:09 -0500
From: John Porter <jdporter@min.net>
Subject: Re: why no Case statment?
Message-Id: <34F481A9.3F35@min.net>
Of course, perl also nicely supports the "dispatch table"
paradigm.
%d1 = (
foo => sub { print 'foo'; },
bar => sub { print 'bar'; },
baz => sub { print 'baz'; }
);
$d1{ $x }->();
%d2 = (
-1 => sub { print 'less than'; },
0 => sub { print 'equal to'; },
1 => sub { print 'greater than'; }
);
$d2{ $x cmp $y }->();
John Porter
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 1973
**************************************