[8355] in Perl-Users-Digest
Perl-Users Digest, Issue: 1972 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 25 14:17:28 1998
Date: Wed, 25 Feb 98 11:00:29 -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: 1972
Today's topics:
Re: "Learning Perl" questions and frustrations (Joe McMahon)
?? How to unpack a string into an array ?? <philh@asptech.com>
Re: CGI.pm a part of Perl (was Re: Cookies) uri@sysarch.com
Re: Easy way to "clean" an array (Joe McMahon)
Re: factorial function? (Craig Berry)
file test inside grep() <fbrodsky@sedona.intel.com>
Re: freshly installed perl...now it won't run (MICHELLE MARIE HANKINS)
Re: HELP array stuff (Joe McMahon)
Re: Help: what is the simplest way to return the key of <jdporter@min.net>
Re: How do I create my own perl libraries? [SEEFAQ][SEE (Joe McMahon)
Re: how do I read the Time and Date with CGI? <harryn@cerf.net>
Re: how to rename coderefs ? <jdporter@min.net>
Re: I really need your help. <jdporter@min.net>
Idea for New Perl Global Variable <philen@ans.net>
Re: Installing ExtUtils Problems (Nathan V. Patwardhan)
Re: Java's hidden flaw <jdporter@min.net>
Re: Need news2HTML tool (Earl Hood)
Re: regexp problem (Craig Berry)
SOLUTION: Perl CGI and Netscape Enterprise Server 3 <info@channel-a.com>
sorting array <charlesb@ccmail.orst.edu>
Re: Stripping linefeeds <jim.michael@gecm.com>
Re: Stripping linefeeds (Earl Hood)
Re: The Ineffable Tom C. <upsetter@shore.net>
Re: ts: Remove files in a PERL sript uri@sysarch.com
Re: Why install perl? (Steve Linberg)
Re: Why install perl? <upsetter@shore.net>
Re: why no Case statment? <philen@ans.net>
Re: Year 10000 Compliance <lyonsj@bgnet.bgsu.edu>
Re: Year 10000 Compliance (Austin Hastings)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 25 Feb 1998 12:32:53 -0500
From: joe.mcmahon@gsfc.nasa.gov (Joe McMahon)
Subject: Re: "Learning Perl" questions and frustrations
Message-Id: <joe.mcmahon-2502981232530001@prtims.stx.com>
In article <34ee3454.50494916@news.csrlink.net>, dep2@csrlink.net (David
Pinkerton) wrote:
>I've been starting to work my way through this book recently and have
>come across several operators (?) that have not worked. The first is
>the "chomp" command. This is the example:
>
>$name = <STDIN>;
>chomp ($name);
>
>and here is the error I receive:
>
>syntax error in file hello.sh at line 5, next 2 tokens "chomp ("
>Execution of hello.sh aborted due to compilation errors.
You know what? It sounds an awful lot like you have perl4, not perl5, when
neither "qw" nor "chomp" works. You'd better check.
--- Joe M.
------------------------------
Date: Wed, 25 Feb 1998 10:54:19 -0800
From: Phil Hutchinson <philh@asptech.com>
Subject: ?? How to unpack a string into an array ??
Message-Id: <34F468DB.49E5@asptech.com>
Environment: Perl 5
I wish to use shared memory to pass an array between 2 processes.
shmwrite and shmread stipulate that I must write a string.
I can use.....
$string = "@array";
shmwrite( $id, $string, .....);
...to write the information by one process, followed by .....
shmread( $id, $string, .....);
...to get the string into the other process BUT....
HOW CAN I UNPACK THE $string BACK INTO @array so that I can use
the elements individually???
Thanks In Advance,
--
=================================================================
Philip L. Hutchinson phone: 970-686-1211
ASP Technologies, Inc. 800-516-0841
1200 Carousel Drive, Suite #103 fax: 970-686-7075
Windsor, Colorado 80550 USA
email: philh@asptech.com
=================================================================
------------------------------
Date: 25 Feb 1998 12:06:33 -0500
From: uri@sysarch.com
Subject: Re: CGI.pm a part of Perl (was Re: Cookies)
Message-Id: <x73eh7397q.fsf@sysarch.com>
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.
> 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, the standard Perl
modules and pragmas are NOT Perl but assumed to be there.
uri
--
Uri Guttman SYStems ARCHitecture and Software Engineering
uri@sysarch.com Have Perl, Will Hack
http://www.sysarch.com (781) 643-7504 x*2 FAX: (781) 643-2710
Try the Best Search Engine on the Net --------> http://www.northernlight.com
------------------------------
Date: Wed, 25 Feb 1998 12:57:55 -0500
From: joe.mcmahon@gsfc.nasa.gov (Joe McMahon)
Subject: Re: Easy way to "clean" an array
Message-Id: <joe.mcmahon-2502981257550001@prtims.stx.com>
In article <34F4336B.141C@schweiz.org>, 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 ?
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;
}
This is a pretty standard algorithm. Key points are the next, which skips
pairs, the push in the loop, which skips the push for the dummy undef entry,
and the push after the loop, which adds the last element if it is an unpaired
element.
I'm sure there are more compact ways to do it, but this works.
--- Joe M.
------------------------------
Date: 24 Feb 1998 19:41:01 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: factorial function?
Message-Id: <6cv7od$qtv$2@marina.cinenet.net>
Paulo Dutra (paulo@xilinx.com) wrote:
: Is there a recommended library to handle factorial implementations?
For ordinary purposes, a simple iterative factorial function like this
should serve well (untested):
sub factorial
{
my $val = shift;
my $acc = $val;
$acc *= $val while --$val > 1;
return $acc;
}
---------------------------------------------------------------------
| 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: Wed, 25 Feb 1998 09:55:26 -0700
From: Franklin Brodsky <fbrodsky@sedona.intel.com>
Subject: file test inside grep()
Message-Id: <34F44CFE.313DD44F@sedona.intel.com>
#!/usr/bin/perl -w
# My questions are at the end of the script.
# open the current directory
opendir(WORKDIR, ".") || die "Can't open directory '.'\n";
# look for names of directories which contain a "." but do not start
with it.
@subdirs = grep ( /\./ , grep ( !/^\./ , grep ( -d ,
readdir(WORKDIR))));
# close the directory
closedir(WORKDIR);
# see what we snagged
print "snagged: ", join(" ",@subdirs), "\n";
# Find any files within these directories whose names begin with the
# name of the directory
foreach $dir (@subdirs) {
print "Looking in ./$dir\n";
opendir(SUBDIR, "./${dir}") || die "Can't open directory ./${dir} :
$!\n";
# The following line should (a) read the contents of the SUBDIR
directory
# (b) filter *out* files which are not plain
files
# (no directories or links for me, please)
# (c) pass along the names of only those files
# whose names begin with the name of the
# directory in which they are found
@testfiles = grep ( /^$dir/ , grep ( -f , readdir(SUBDIR)));
closedir(SUBDIR);
print join(" ",@testfiles),"\n\n";
# sanity check 1, if a file exists, print its name
print "sanity check 1 for ./$dir\n";
opendir(SUBDIR, "./${dir}") || die "Can't open directory ./${dir} :
$!\n";
@testfiles = grep ( -e , readdir(SUBDIR));
closedir(SUBDIR);
print join(" ",@testfiles),"\n\n";
# insanity check 1, if a file does not exist, print its name
print "insanity check 1 for ./$dir\n";
opendir(SUBDIR, "./${dir}") || die "Can't open directory ./${dir} :
$!\n";
@testfiles = grep ( !(-e) , readdir(SUBDIR));
closedir(SUBDIR);
print join(" ",@testfiles),"\n\n";
# sanity check 2, if a file is a plain file, print its name
print "sanity check 2 for ./$dir\n";
opendir(SUBDIR, "./${dir}") || die "Can't open directory ./${dir} :
$!\n";
@testfiles = grep ( -f , readdir(SUBDIR));
closedir(SUBDIR);
print join(" ",@testfiles),"\n\n";
# insanity check 2, if a file is not a plain file, print its name
print "insanity check 2 for ./$dir\n";
opendir(SUBDIR, "./${dir}") || die "Can't open directory ./${dir} :
$!\n";
@testfiles = grep ( !(-f) , readdir(SUBDIR));
closedir(SUBDIR);
print join(" ",@testfiles),"\n\n";
};
print "\n\nThe following is my directory structure
.
..
./one.two/
./one.two/.
./one.two/..
./one.two/one.two.ext
./three.four/
./three.four/.
./three.four/..
./three.four/three.four.ext
one.two.ext and three.four.ext both contain
'this is a dummy file'
The following is my actual output when
this print statement is commented out
-------------------------------------
snagged: one.two three.four
Looking in ./one.two
sanity check 1 for ./one.two
. ..
insanity check 1 for ./one.two
one.two.ext
sanity check 2 for ./one.two
insanity check 2 for ./one.two
. .. one.two.ext
Looking in ./three.four
sanity check 1 for ./three.four
. ..
insanity check 1 for ./three.four
three.four.ext
sanity check 2 for ./three.four
insanity check 2 for ./three.four
. .. three.four.ext
-------------------------------------
Why is '-e' behaving the way '!(-f)' should?
Why is '!(-e)' behaving the way '-f' should?
Why is '-f' behaving the way '!(-e)' should?
Why is '!(-f)' behaving the way '-e' should?
If your output does not match mine, then I
am using a corrupt distribution of perl5.003
If yours does match mine, then either I am
attempting to do something syntactically wrong
or there is a bug in the perl5.003 file tests.\n";
--
Franklin Brodsky, faithful employee fbrodsky@sedona.intel.com
Opinions expressed above are mine, and not necessarily those of Intel.
------------------------------
Date: 25 Feb 1998 17:17:41 GMT
From: mmhankin@ouray.cudenver.edu (MICHELLE MARIE HANKINS)
Subject: Re: freshly installed perl...now it won't run
Message-Id: <6d1jnl$1r1$1@news.cudenver.edu>
Thanks to everybody who responded to me. I'll mess around some more.
I think the key was the ^D. Very obvious keystroke to make to terminate
the command, unless you're working in a veritable vaccum and that
particular keystroke never occurs to you.
I'll try some more. Thanks.
--
Michelle Hankins,
realemail: michelle_hankins@polk.com
playemail: mmhankin@ouray.cudenver.edu
Trephination procedures should be a corporate benefit.
------------------------------
Date: Wed, 25 Feb 1998 12:18:10 -0500
From: joe.mcmahon@gsfc.nasa.gov (Joe McMahon)
Subject: Re: HELP array stuff
Message-Id: <joe.mcmahon-2502981218100001@prtims.stx.com>
In article <34F339F4.41C6@giss.nasa.gov>, Douglas Cordero
<dcordero@giss.nasa.gov> 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.
>
How about
print "Warning: sizes do not match" if scalar(@array1) != scalar(array2);
foreach my $seek (@array1) {
print STDERR "$seek missing\n" unless grep(/\Q$seek\E/,@array2);
}
--- Joe M.
------------------------------
Date: Wed, 25 Feb 1998 12:11:43 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Help: what is the simplest way to return the key of an associated array?
Message-Id: <34F450CF.1171@min.net>
Tommy wrote:
>
> my %Array= ("A" => 65, "B"=> 66, "C" => 67, "D" => 68);
> @ANS= &key(VALUE => 67, ARRAY= \%Array);
>
> sub key {
> my %Q= @_;
> my (@ANS);
> foreach $_ (keys(%{$Q{ARRAY}})) {
> if (${$Q{ARRAY}}{$_} eq $Q{VALUE}) {
> push(@ANS, $_);
> last;
> }
> }
> return @ANS if (@ANS);
> }
You can do the same thing in one line, thus obviating the need
for a subroutine:
my %Array = ( "A" => 65, "B"=> 66, "C" => 67, "D" => 68 );
my $value = 67;
# do it using grep:
@ans = grep( $Array{$_} == $value, keys %Array );
Keep in mind how you do your comparison. I used '==' here
because we're comparing numbers. 'eq' is more general, but
may be slower if the comparands have to be converted.
hth,
John Porter
------------------------------
Date: Wed, 25 Feb 1998 12:38:35 -0500
From: joe.mcmahon@gsfc.nasa.gov (Joe McMahon)
Subject: Re: How do I create my own perl libraries? [SEEFAQ][SEEMAN]
Message-Id: <joe.mcmahon-2502981238350001@prtims.stx.com>
In article <34F3FCFF.5E5194AF@pacificnet.net>, 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.
Yes, you can. Perl provides structures for this (packages and modules).
Once you've checked the documentation on how to do this, you should know
that one
of the default places Perl looks for modules is in the same directory as
the one where the program resides. If you'd prefer, you can choose a
specific directory elsewhere and insert a "use lib 'libname'" statement to
tell Perl to go look
there.
Detailed info available in the Perl man pages and the FAQ.
--- Joe M.
------------------------------
Date: Wed, 25 Feb 1998 09:40:37 -0800
From: Hoang Nguyen <harryn@cerf.net>
To: Preferred Client <johnh@studiopointe.com>
Subject: Re: how do I read the Time and Date with CGI?
Message-Id: <Pine.SOL.3.94.980225093826.12097A-100000@staff.cerf.net>
On Fri, 26 Sep 1997, Preferred Client wrote:
> I am writing a cgi script that allows the ADMIN to update mortgage prices
> The script is working fine but I would like to have it display
> a time and date stamp to the Html file it generates. This date and time
> stamp would tell the viewer how up to date the information is.
>
> If anyone know of a way to get the time and date information in CGI, or
> Javascript, your help would be appreciated.
>
>
>
> --
> John Hocking
> Web Designer
> mailto:johnh@studiopointe.com
> http://www.studiopointe.com
>
>
you can add this line to you your CGI script:
print scalar localtime();
Z
Hoang Nguyen
hoang@cerf.net
------------------------------
Date: Wed, 25 Feb 1998 12:32:50 -0500
From: John Porter <jdporter@min.net>
Subject: Re: how to rename coderefs ?
Message-Id: <34F455C2.2CAA@min.net>
Joseph Wayne Norton wrote:
>
> I would like to be able to do the following code snippet (similar to
> the rename proc in Tcl):
>
> sub foo {
> }
>
> rename foo _foo
>
> sub foo {
> my ($self) = &_foo(@_);
> # do some processing
> return($self);
> }
Typeglobs is the right way. Here's a simple example.
sub foo {
print "original foo.\n";
}
sub new_foo {
print "new foo, calling old foo.\n";
old_foo(); # yah, better be defined by now.
}
*old_foo = \&foo;
*foo = \&new_foo;
foo();
> use LWP::UserAgent;
>
> package LWP::UserAgent;
> *_new{CODE} = *new{CODE};
>
> sub new {
> my ($self) = &_new(@_);
> $self->agent('Mozilla/3.01');
> return($self);
> }
I would say you are probably going about this the wrong way.
If I were doing this, I would use inheritance.
package MyUserAgent;
@ISA = qw( LWP::UserAgent );
sub new {
my $p = shift;
my $self = $p->SUPER::new( @_ );
$self->agent('Mozilla/3.01');
$self;
# or bless $self, $p; # if you override other methods.
}
Then you just need to make a new MyUserAgent in your
client code, rather than new LWP::UserAgent.
The object will still be a LWP::UserAgent. This is o.k.
if the only method you override is new; if you need
to override other methods, you will want to rebless the
object as a MyUserAgent.
hth,
John Porter
------------------------------
Date: Wed, 25 Feb 1998 12:58:47 -0500
From: John Porter <jdporter@min.net>
Subject: Re: I really need your help.
Message-Id: <34F45BD7.6863@min.net>
You would be much better off using the File::Find module.
For example:
use File::Find;
find(
sub {
if ( /\.html?$/i && -r $_ ) {
if ( $curdir ne $File::Find::dir ) {
print "$File::Find::dir\n";
$curdir = $File::Find::dir;
}
print "\t$_\n";
}
},
"/home/bunny"
);
Also, you would have gotten a good clue what your
problem was, if had included $! in your error message:
print "can't open dir $locdir: $!\n";
hth,
John Porter
------------------------------
Date: Wed, 25 Feb 1998 13:13:01 -0500
From: Phillip Lenhardt <philen@ans.net>
Subject: Idea for New Perl Global Variable
Message-Id: <Pine.GSO.3.95.980225130701.11094C-100000@earn.aa.ans.net>
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.
-phil
--
In the long term, we will all be dead. philen@ans.net
------------------------------
Date: 25 Feb 1998 17:49:52 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Installing ExtUtils Problems
Message-Id: <6d1lk0$bat@fridge.shore.net>
John "Chris" Wren (jcwren@atlanta.com) wrote:
: I've installed ActiveStates Perl 5.003_7. I'd like to install
: the libwww kit, but to build it I have to have MakeMaker installed.
Use Sarathy's port instead. It's bundled with LWP and pTk.
--
Nathan V. Patwardhan
------------------------------
Date: Wed, 25 Feb 1998 13:37:50 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Java's hidden flaw
Message-Id: <34F464FE.6DFC@min.net>
Billy Vitro wrote:
>
> From EDTN's News of the Week:
> Software:
> http://www.edtn.com/scribe/notw/980220.htm#software
>
> Java's creator says the software was never intended to be a commercial
> product.
I'm going to comment on some of this article. (It's a good read, btw.)
> "I've had a lot of developers
> come up to me and say, 'I haven't had this much fun
> in a long time. It sure beats writing Cobol,' " he said.
So now we know the real reason for the hype: java is beloved
by ex-cobol programmers. Pounding on my head with a hammer
does indeed feel better than sticking a hot poker in my eye.
> "Our JVM was designed for portability," he [James]
> said. "It was designed to be adequate for running in a
> browser, not on an application server."
And this legacy will continue to haunt Java, all the way to the grave.
> But now that Java is a runaway hit among
> programmers, Sun Microsystems -- Gosling's employer
> -- is making the most of it.
I believe this shows that the blame rests squarely on Sun's
shoulders, more so than James' particularly. After all, what
computer scientist or hacker hasn't invented his own language
or three? But when Sun's marketroids get hold of it....
Now look what they're doing to Tcl -- "SunScript".
"A Sun development team dedicated to promoting Tcl/Tk as the
scripting language for the next generation of enterprise and
Internet applications." (sunscript.sun.com)
Freedom fighters, unite! I hereby declare common cause
(on behalf of Perl, if I may be so bold), with The Legions
of Guido (http://www.python.org/), Guy's Guerillas
(http://www.ai.mit.edu/projects/su/su.html), and The Acolytes
of The Other Camel (http://pauillac.inria.fr/ocaml/).
John Porter
------------------------------
Date: 25 Feb 1998 17:03:14 GMT
From: ehood@medusa.acs.uci.edu (Earl Hood)
Subject: Re: Need news2HTML tool
Message-Id: <6d1isi$45a@news.service.uci.edu>
In article <6d0fqn$8o9$2@dogwood.fernuni-hagen.de>,
Markus Wannemacher <Markus.Wannemacher@FernUni-Hagen.De> wrote:
>I am loooking for a tool that converts automaticaly an
>archive of news messages to html files. It should
>generate a html page with links to all threads,
>thrads pages with links to all articels in the thread
>and article pages with links to the thread page, the
>previous and the next article, ...
http://www.oac.uci.edu/indiv/ehood/mhonarc.html
--ewh
--
Earl Hood | University of California: Irvine
ehood@medusa.acs.uci.edu | Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME
------------------------------
Date: 24 Feb 1998 19:28:40 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: regexp problem
Message-Id: <6cv718$qtv$1@marina.cinenet.net>
Bart Lateur (bart.mediamind@tornado.be) wrote:
: mkolus@atomico.com.ar wrote:
:
: >Hello! Why this: s/^From:\s([^\S]*)/\1/i; return an string with the \n at
: >the end?.. i also tried [^\n\r] and didnt work.
:
: Next to all clever solutions to patch your replacement, I'd like to
: suggest you to reconsider an alternative approach.
:
: What you want is to kill everything but what's between parentheses? Then
: just do this:
:
: ($from)=/^From:\s([^\S]*)/;
Not clear how '[^\S]*' differs from '\s*'. Neither one will match on
anything other than whitespace. Perhaps you mean \S*?
---------------------------------------------------------------------
| 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: Mon, 23 Feb 1998 09:38:20 +0000
From: David Rawle <info@channel-a.com>
Subject: SOLUTION: Perl CGI and Netscape Enterprise Server 3
Message-Id: <34F1438C.E4C6D0A5@channel-a.com>
I got the following error out of Netscape Enterprise Server...
[11/Feb/1998:17:14:04] failure: for host 10.0.0.10 trying to POST
/shell-cgi/file-upload.pl, cgi-parse-output reports: the CGI program
C:\PERL\bin\perl.exe did not produce a valid header (program terminated
without a valid CGI header (check for core dump or other abnormal
termination)
NT hadn't reported any abnormal terminations. The problem was
repeatable.
My environment is:
Microsoft NT Server 4.0 (SP3)
Netscape Enterprise Server 3.0
Perl 32 5.003_007 (downloaded yesterday)
Netscape Navigator 4.04
SOLUTION:
Put the CGI.pm file in c:\perl\lib (or equivalent) instead of the
directory where the CGI script resides (as the documentation tells
you). This is a fix for Netscape only, other servers we tried seemed
happy with the CGI.pm file to be in the directory with the PERL script.
------------------------------
Date: Wed, 25 Feb 1998 09:51:05 -0800
From: Brian Charles <charlesb@ccmail.orst.edu>
Subject: sorting array
Message-Id: <34F45A09.27B6D03A@ccmail.orst.edu>
Hi,
I have a file with the following info that I would like to hash:
lastname|firstname|email|code
Right now I have a hash with a key and value and it sorts fine, but how
do I have more than one value? Just point me in the right direction.
Thanks
Brian
------------------------------
Date: Wed, 25 Feb 1998 11:57:20 -0500
From: Jim Michael <jim.michael@gecm.com>
Subject: Re: Stripping linefeeds
Message-Id: <34F44D70.6FEF@gecm.com>
Norman Bunn wrote:
> 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?
See your documentation on the chomp function:
chomp @my_array_with_linefeeds;
Cheers,
Jim
------------------------------
Date: 25 Feb 1998 17:10:16 GMT
From: ehood@medusa.acs.uci.edu (Earl Hood)
Subject: Re: Stripping linefeeds
Message-Id: <6d1j9o$4c4@news.service.uci.edu>
[mail and posted]
In article <00YI.8848$pf.884826@news.internetMCI.com>,
Norman Bunn <norman.bunn@mci.com> wrote:
>Any help on removing the LF?
chomp
--ewh
--
Earl Hood | University of California: Irvine
ehood@medusa.acs.uci.edu | Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME
------------------------------
Date: 25 Feb 1998 17:00:02 GMT
From: Art Cohen <upsetter@shore.net>
Subject: Re: The Ineffable Tom C.
Message-Id: <6d1imi$77l@fridge.shore.net>
shaker@netusa1.net wrote:
: (1) There are folks who do not get access past the firewall, at their places
: of work.
If they have Perl, they have the documentation. They come in the same
package.
--Art
National Ska/Reggae Calendar: www.ziplink.net/~upsetter/ska/calendar.html
Boston Ska Home Page: www.ziplink.net/~upsetter/ska/index.html
------------------------------
Date: 25 Feb 1998 12:03:48 -0500
From: uri@sysarch.com
Subject: Re: ts: Remove files in a PERL sript
Message-Id: <x74t1n39cb.fsf@sysarch.com>
<soul@explorer.com> writes:
> yeah all you hardcore perl hackers make this joint a dull experience.
>
> the reason people are asking questions that are in the faq and the
> manpages is because the manpages are way technical and half the
> time don't explain stuff thoroughly!
>
> >| Don't tell people answers that are in the manpages or faqs.
> >
> >Wrong. You so easily dismiss people who are new to perl.
> >I don't feel it's proper for you to cut and dry it as you
> >do. It doesn't help the discussion for you to be so impenetrable.
> ---------------------------------------------------------------
who said this is meant to be easy. i have always said programming is
easier and harder than it looks. perl is easy to use and hard to master
since it is a programming language, not a toy. manual pages are not
tutorials. you want handholding, pay for a class, buy a good book, but
don't bother the professionals with how to print "hello world" for the
nth time. it gets to be VERY annoying that newbies do not read what they
are given that is meant to help them, like FAQs and various online
tutorials BEFORE they bug clpm with repetitious and off-topic
questions.
i try to help reasonable Perl language questions, like pattern matching
or ways of doing something beyond newbie stuff.
'nuff anger for now.
uri
--
Uri Guttman SYStems ARCHitecture and Software Engineering
uri@sysarch.com Have Perl, Will Hack
http://www.sysarch.com (781) 643-7504 x*2 FAX: (781) 643-2710
Try the Best Search Engine on the Net --------> http://www.northernlight.com
------------------------------
Date: Wed, 25 Feb 1998 12:02:15 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Why install perl?
Message-Id: <linberg-2502981202160001@pri03-007.oldcity.dca.net>
In article <34F42429.57C31145@domain.com>, Hansen <defaultuser@domain.com>
wrote:
> 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.
> Would installing it allow me to test the scripts without ftp-ing?
This is a question for your sysadmin. We don't know how your sever is set
up, or what kind of activity is allowed on it.
The answer to your question is probably yes, assuming Perl is running on
your campus server, which it probably is. But ask your sysadmin.
You might want to install it locally too, to save some trouble. It's easy.
--
slinberg@ com
crocker.
Try that one, spambots!
------------------------------
Date: 25 Feb 1998 17:11:09 GMT
From: Art Cohen <upsetter@shore.net>
Subject: Re: Why install perl?
Message-Id: <6d1jbd$77l@fridge.shore.net>
Hansen <defaultuser@domain.com> wrote:
: 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.
: Would installing it allow me to test the scripts without ftp-ing?
Presumably perl is already installed on the web server to which you are
ftping your scripts, or they wouldn't run.
You could install it on your own machine, and then test scripts from the
command line to see whether they work (this is easier if you use CGI.pm,
but Gundavaram doesn't discuss it, as I recall). Or, if you had a web
server *and* perl installed on your own PC, you could run them as CGI from
your own desktop without ftping.
--Art
National Ska/Reggae Calendar: www.ziplink.net/~upsetter/ska/calendar.html
Boston Ska Home Page: www.ziplink.net/~upsetter/ska/index.html
------------------------------
Date: Wed, 25 Feb 1998 13:31:15 -0500
From: Phillip Lenhardt <philen@ans.net>
To: Tzadik Vanderhoof <stvhoof@netvision.net.il>
Subject: Re: why no Case statment?
Message-Id: <Pine.GSO.3.95.980225132507.11094D-100000@earn.aa.ans.net>
On Mon, 23 Feb 1998, Tzadik Vanderhoof wrote:
> Why doesn't Perl have a real Case statement? I've read what the Camel
> book says about the "alternatives", but none of them are really as nice
> as a real Case statement supported directly by the language. I realise
> that this is something that probably only Larry could answer, and I've
> heard he no longer sees this newsgroup, but maybe someone has some ideas
> about this...
I can't remember exactly where in the various perl docs I saw this, but I
do remember a reason for no case statement. Larry couldn't decide what
context to do case comparison on: scalar? list? regex?
-phil
--
In the long term, we will all be dead. philen@ans.net
------------------------------
Date: Wed, 25 Feb 1998 12:50:44 -0500
From: Jen Lyons <lyonsj@bgnet.bgsu.edu>
Subject: Re: Year 10000 Compliance
Message-Id: <Pine.SGI.3.95.980225125032.24041A-100000@sigma.bgsu.edu>
On Wed, 25 Feb 1998, x wrote:
> On Tue, 24 Feb 1998 16:27:18 GMT, Binyamin_Dissen@theoffice.net
> (Binyamin Dissen) wrote:
>
> >Not a problem. There will be no need for computers come the year 6000, if
> >indeed we must wait that long.
>
>
> Why? What happens then?
Why, the world ends, of course!
Jen
"Software is like sex; it's better when it's free."
--Linus Torvalds
------------------------------
Date: 25 Feb 1998 13:46:37 -0500
From: hastinga@tarim.dialogic.com (Austin Hastings)
Subject: Re: Year 10000 Compliance
Message-Id: <c3yayz4j5e.fsf@tarim.dialogic.com>
>>>>> "x" == x <x@x.x> writes:
In article <34f39beb.21236053@news3.newscene.com> x@x.x (x) writes:
x> On Tue, 24 Feb 1998 16:27:18 GMT, Binyamin_Dissen@theoffice.net
x> (Binyamin Dissen) wrote:
>> Not a problem. There will be no need for computers come the year
>> 6000, if indeed we must wait that long.
x> Why? What happens then?
Stick around. You'll find out...
=Austin :->
--
____________________________________
D I A L Austin Hastings
_|_|_|O SCM Administrator
_|_|_|G Dialogic Corporation
_|_|_|I 1515 Rt. 10 Parsippany,NJ 07054
_|_|_|C (201)993-3000 ext. 6546
------------------------------
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 1972
**************************************