[13624] in Perl-Users-Digest
Perl-Users Digest, Issue: 1034 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Oct 10 22:05:27 1999
Date: Sun, 10 Oct 1999 19:05:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <939607511-v9-i1034@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 10 Oct 1999 Volume: 9 Number: 1034
Today's topics:
Re: .pl files How to convert in text format ? (David Efflandt)
Debugger and "O LineInfo=..." (Chris Fedde)
Re: Expiring Pages (Abigail)
Re: Help - Perl regular expression question! <ltl@rgsun40.viasystems.com>
Re: Help - Perl regular expression question! <ltl@rgsun40.viasystems.com>
Re: Help! (David Efflandt)
Re: Hosts running Mason and ImageMagic <norman.bunn@worldnet.att.net>
Re: how to call a sub roght by form (Martien Verbruggen)
Re: howto load modules to an ISP website? (Abigail)
Re: howto load modules to an ISP website? <dtbaker_@busprod.com>
Macintosh: Get info about aliases (mark thompson)
Re: need csh > perl advice <reply@the.ng>
Re: need csh > perl advice <reply@the.ng>
Perl & Sockets <rix@removethis.xs4all.nl>
Re: Perl CGI/Browser Output Bug - Help! (David Efflandt)
Printing Unique fileds of a text database-help me? <garmark2NOgaSPAM@hotmail.com.invalid>
Re: Receiving e-Mail Messages via Mail::POP3Client, wit (Paul Schinder)
Re: serching flat file database <dave@dave.org.uk>
trouble with hash (Mark P.)
Re: trouble with hash (Larry Rosler)
Re: trouble with hash <dove@abelo.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 9 Oct 1999 23:58:41 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: .pl files How to convert in text format ?
Message-Id: <slrn7vvlm8.3ul.efflandt@efflandt.xnet.com>
On Sat, 09 Oct 1999 23:18:44 +0200, ledanseurs <memoire@worldnet.fr> wrote:
>
>I am working on Win NT 4 Workstation. I was given some files with 'pl'
>extension,
>(ex file.pl ), I can read them with a software called Worldview.
>I have to convert those files to text files (.txt), do you know how to
>do that ?
>If I open those files with Word Pad or Note pad , they are full of
>unreadable ascii
>caracters, so i really need a program that can convert those kind of
>files.
Probably Unix text files that are missing the carriage return that DOS/Win
use. So the newline shows up as a black box in Notepad.
If you have MS Word, or other word processor, you should be able to
load them fine and then save as DOS text.
--
David Efflandt efflandt@xnet.com http://www.xnet.com/~efflandt/
http://www.de-srv.com http://cgi-help.virtualave.net/
http://thunder.prohosting.com/~cv-elgin/
------------------------------
Date: Sun, 10 Oct 1999 04:49:37 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Debugger and "O LineInfo=..."
Message-Id: <BVUL3.59$F3.172436480@news.frii.net>
Some oddness that I have not been able to explain. I have created
a little shell script called "catit" containing the following:
#!/bin/sh
cat -u >> /tmp/file
And a miniscule perl script called "t.pl" containing:
print "one\n";
for (1..10) {
print "\$_ is $_\n";
}
Now if I start perl -d t.pl and set "O LineInfo=|catit" at the
DB<1> prompt, then hit "n" and <enter> a few times /tmp/file will
contain something like the following
t.pl:3:0
t.pl:4:0
t.pl:3:0
t.pl:4:0
t.pl:3:0
t.pl:4:0
...
But if I "export PERLDB_OPTS="LineInfo=|catit" and redo the previous steps
/tmp/file contains the following:
main::(t.pl:1): print "one\n";
main::(t.pl:3): for (1..10) {
main::(t.pl:4): print "\$_ is $_\n";
main::(t.pl:3): for (1..10) {
main::(t.pl:4): print "\$_ is $_\n";
main::(t.pl:3): for (1..10) {
main::(t.pl:4): print "\$_ is $_\n";
main::(t.pl:3): for (1..10) {
...
Why did the format change?
tia
chris
------------------------------
Date: 9 Oct 1999 19:13:33 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Expiring Pages
Message-Id: <slrn7vvmh3.iq.abigail@alexandra.delanet.com>
gus@asus.net (gus@asus.net) wrote on MMCCXXX September MCMXCIII in
<URL:news:rvvlbtamh1s45@news.supernews.com>:
-- How do I expire a page once it has loaded. I do not want people to be able
-- to refresh the page...
Remove it as soon as you handed it out.
But what has this to do with Perl?
Abigail
--
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 10 Oct 1999 00:34:22 GMT
From: lt lindley <ltl@rgsun40.viasystems.com>
Subject: Re: Help - Perl regular expression question!
Message-Id: <7tomue$s9o$1@rguxd.viasystems.com>
Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
:>> I think I finally parsed it. Why is it any better than
:>> /foo(?<!kfoo)(?=d)/
:>Because here you do not see 'kfood'.
OK. Brain cramp. And even if I had done (?!d) it still
wouldn't have matched correctly on 'kfoox'.
:>> # or
:>> /(?<!k)foo(?=d)/ # Much easier to read IMO
:>Here you check for (?<!k) at each position.
And same problem here in addition to your point about the
inefficiency. It isn't the same pattern that you showed.
Funny, but I had thought of the zero width assertions as items
that were checked after finding a match for the rest of the pattern.
Rereading perlre I see no reason why I should have had that
misconception. In fact perlre is quite specific in describing
the left to right evaluation.
The fact that (?<!kfoo(?=d)) is even legal is not
clear from reading perlre. It states that lookbehinds
must be fixed length. Now (?=d) may not have any length,
but it sure looks like trickery to be able to include it in
a construct that is called a "lookbehind."
Thanks.
--
// Lee.Lindley /// I used to think that being right was everything.
// @bigfoot.com /// Then I matured into the realization that getting
//////////////////// along was more important. Except on usenet.
------------------------------
Date: 10 Oct 1999 00:53:47 GMT
From: lt lindley <ltl@rgsun40.viasystems.com>
Subject: Re: Help - Perl regular expression question!
Message-Id: <7too2r$sku$1@rguxd.viasystems.com>
In a fit of false cleverness I wrote:
:>Here is the code I used to test what I just wrote:
:>#!/usr/lib/lprgs/perl -w
:>use strict;
:>my $pattern = "bcd";
:>my $bigger_pattern = "abcde";
:>my ($leading_part, $trailing_part) =
:> ($bigger_pattern =~ /^(.*?)$pattern(.*)$/);
:># No error checking to see if that matched or that both parts
:># contain anything useful.
:>my $line = "lllbcdlllabcdelllbcd";
:>my $replacement = "wyz";
:>$line =~ s/(?<!$leading_part)$pattern(?!$trailing_part)/$replacement/g;
:>#:>The above will change $line to "lllwyzlllabcdelllwyz".
:>print $line;
:>__END__
:>lllwyzlllabcdelllwyz
The problem statement was to match a pattern that is not contained
within a larger pattern. Ilya made some points later in this thread
that made me realize that I was mistaken. I see now that the
above is not a correct solution. It would fail to match "bcd" when
it occured in "abcdx". :-(
Using the trickery that Ilya showed:
#!/usr/lib/lprgs/perl -w
use strict;
my $pattern = "bcd";
my $bigger_pattern = "abcde";
my ($leading_part, $trailing_part) = ($bigger_pattern =~ /(.*?$pattern)(.*)/);
# No error checking to see if that matched or that both parts
# contain anything useful.
my $line = "lllabcdlllabcdelllbcd";
my $replacement = "wyz";
$line =~ s/$pattern(?<!$leading_part(?=$trailing_part))/$replacement/g;
# s/bcd (?<!abcd (?=e) )/wyz/g;
print $line
__END__
lllawyzlllabcdelllwyz
--
// Lee.Lindley /// I used to think that being right was everything.
// @bigfoot.com /// Then I matured into the realization that getting
//////////////////// along was more important. Except on usenet.
------------------------------
Date: 10 Oct 1999 00:37:18 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Help!
Message-Id: <slrn7vvnuk.3ul.efflandt@efflandt.xnet.com>
On Sun, 10 Oct 1999 01:32:07 +0100, Acacia <acacia@online.no> wrote:
>Ok, I'm pretty new at this, but im trying to set up a website without hiring
>a programmer...
>
>How can I transform a URL into the name of the last subdirectory of the
>given URL ?
>What I'm saying is, how do I, for instance, turn
>http://www.something.com/anything into 'anything' ...
In what context? What you show here is a URL that ends with a filename,
not a directory. A directory (default index) would have a trailing slash.
However, you may not be aware of it because the webserver will usually
redirect you to the correct URL with trailing slash.
With that in mind, this is a Perl example of how to parse the last dir out
of a "valid" URL (don't expect it to work with invalid URL's):
#!/usr/bin/perl
$_= shift; # URL from command line
print "URL: $_\n";
if (m|[^/]/([^/]+)/[^/]*$|) {
print "Last dir: $1\n";
} else {
print "The URL does not contain a dir\n";
}
--
David Efflandt efflandt@xnet.com http://www.xnet.com/~efflandt/
http://www.de-srv.com http://cgi-help.virtualave.net/
http://thunder.prohosting.com/~cv-elgin/
------------------------------
Date: Sun, 10 Oct 1999 20:50:50 -0400
From: "Norman Bunn" <norman.bunn@worldnet.att.net>
Subject: Re: Hosts running Mason and ImageMagic
Message-Id: <7trccg$gu1$1@bgtnsc02.worldnet.att.net>
I put a :) at the end of my post indicating I was not being all that
serious. Sorry if it didn't come across that way. I only went to all that
detail to help those who might not be aware of these two concepts, though I
must admit I was feeling a bit defensive after being cut short the first
time.
In any case, thanks for clarifying what I was trying to ask and explaining
the overall perl connection . Since you think that connection tenuous at
best (though I respectfully disagree), do you have any suggestions on which
newsgroup might be a better venue for such a question? I thought this one
might be since ImageMagick comes up quite a bit on the ActivePerl Win32
users maillist. Given most ISPs run Unix, I was going to this group for a
broader perspective than I could get there.
Norman
Martien Verbruggen <mgjv@wobbie.heliotrope.home> wrote in message
news:slrn7vtf4q.12n.mgjv@wobbie.heliotrope.home...
> On Fri, 08 Oct 1999 16:21:09 GMT,
> Norman Bunn <norman.bunn@mci.com> wrote:
>
> > Well, let's see. HTML::MASON is a perl module for component-based
> > pages (www.masonhq.com and Web Techniques 10/99) and PerlMagick is a
> > perl specific interface to ImageMagick, an image manipulation
> > program. So if I can find a web host that is running the Apache
> > extensions that support HTML::MASON and allow execution of
> > ImageMagick, then I could run cgi-based perl programs that use
> > these.
> >
> > I guess that's what this has to do with Perl. :)
>
> Did you read your original post?
>
> Let me quote:
>
> > Does anyone know of a web hosting company running Mason and/or
> > ImageMagic?
>
> No mention of HTML::MASON, No mention of PerlMagick. You mention Mason
> (which probably no one here even knows), even though the modules
> listen on CPAn (which I just looked up) are listed as Apache::mason
> and HTML::Mason. ImageMagick has nothing to do with Perl. PerlMagick
> is a module for perl to interface with ImageMagick. Following your
> logic, HTML is perl, because there are various modules that Interface
> with HTML. CGI is Perl, because of the CGI module. Many forms of
> encryption are Perl, because there are modules that do encryption.
>
> Furthermore: You do _not_ ask anything about perl, Perl, Perl modules,
> or anything else related to Perl. You ask about the availability of a
> 'web hosting company' that runs some pieces of software. The fact that
> this software has a tangential relationship to perl is irrelevant.
>
> I'm sorry to be so blunt, but you protest too much.
>
> Martien
> --
------------------------------
Date: 10 Oct 1999 05:24:05 GMT
From: mgjv@wobbie.heliotrope.home (Martien Verbruggen)
Subject: Re: how to call a sub roght by form
Message-Id: <slrn8008js.36a.mgjv@wobbie.heliotrope.home>
On Sun, 10 Oct 1999 00:28:01 +0200,
Yuval Hamberg <yhm@inter.net.il> wrote:
> But that dosent work. i lerned that i sould put this in before:
[snip horrible code]
No. What you should do is
use CGI;
in your code, and
# perldoc CGI
from your command line.
Martien
--
Martien Verbruggen |
Interactive Media Division | For heaven's sake, don't TRY to be
Commercial Dynamics Pty. Ltd. | cynical. It's perfectly easy to be
NSW, Australia | cynical.
------------------------------
Date: 9 Oct 1999 19:16:22 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: howto load modules to an ISP website?
Message-Id: <slrn7vvmmb.iq.abigail@alexandra.delanet.com>
Dan Baker (dtbaker@busprod.com) wrote on MMCCXXX September MCMXCIII in
<URL:news:37FFC3CF.CCC0E430@busprod.com>:
.. I have a website that needs to use the optional module Image/Size.pm and
.. my ISP is reluctant to load it for some reason. I have been attempting
.. to copy required files and create a "site" for optional modules in my
.. cgi-bin dir, but I must be missing copying or editting some pieces for
.. the auto-loader or something because I cant get things to work
.. correctly.
That's a FAQ, isn't it?
Abigail
--
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")
-> define ("foldoc", "perl")) [0] -> print'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Sun, 10 Oct 1999 20:50:56 -0500
From: Dan Baker <dtbaker_@busprod.com>
Subject: Re: howto load modules to an ISP website?
Message-Id: <38014280.2376EAC4@busprod.com>
Alan, on one hand I have to thank you because you did provide the
answer, but on the other I just have to wonder why this newsgroup gets
so snippy?! People waste so much energy on being negative... I'll have
you know I spent quite a while poking thru docs, FAQs, search engines
and dejanews without happening to stumble on the answer.
I do thank you for the tip to check in pod/perlfaq8.pod and after
reading, it looks like the makefile is designed to handle this sort of
localize site install. I will give it a try! I'm sorry that you consider
it whining, I just get frustrated by people that make snide and unkind
followup posts indicating that they know the answer, but dont give any
hints where to look. If they feel the question is stupid, then why dont
they just ignore it.
I do appreciate the helpful content of your followup. Hopefully this
newsgroup will someday become a kinder, place to ask a question.
Dan
==================
"Alan J. Flavell" wrote:
> =head2 How do I keep my own module/library directory?
>
> beneath:
>
> =head1 Found in /usr/local/lib/perl5/5.00503/pod/perlfaq8.pod
>
------------------------------
Date: Mon, 11 Oct 1999 00:12:09 GMT
From: mark@squirrel.tgsoft.com (mark thompson)
Subject: Macintosh: Get info about aliases
Message-Id: <mark-1010991712080001@squirrel.tgsoft.com>
I am writing a perl program to do backups from my macintosh to
a remote machine that has a tape drive (think of unix rdump... though
that isn't exactly what I'm doing).
I have run into a problem with aliases. I can detect them easilly enough
with -l; but FSpGetCatInfo - which I use to get the finder information and
file size, seems to 'follow' aliases... ie. it is stat rather than lstat.
In order to back up aliases, I need to get the finder info (lstat). I seem
to be able to actually READ the alias with POSIX::, but maybe I have that
wrong... it would be nice if a guru would give me tips on this, too.
-mark (mark at tgsoft.com)
p.s. I seem to have Perl 5.2.0r4 (17Apr98), if that matters
------------------------------
Date: Mon, 11 Oct 1999 01:34:19 GMT
From: "Matt Hadder" <reply@the.ng>
Subject: Re: need csh > perl advice
Message-Id: <v8bM3.7912$Y96.78097@news.rdc2.occa.home.com>
Yes. One of my primary reasons for leaving one job for another. Now I will
use Perl.
Matt
Tad McClellan <tadmc@metronet.com> wrote in message
news:3bkpt7.11q.ln@magna.metronet.com...
> Matt Hadder (reply@the.ng) wrote:
>
> : I am a decent csh programmer.
>
>
> Ack!
>
>
> "Csh Programming Considered Harmful"
>
> http://www.perl.com/pub/language/versus/csh.html
>
>
> --
> Tad McClellan SGML Consulting
> tadmc@metronet.com Perl programming
> Fort Worth, Texas
------------------------------
Date: Mon, 11 Oct 1999 01:35:43 GMT
From: "Matt Hadder" <reply@the.ng>
Subject: Re: need csh > perl advice
Message-Id: <P9bM3.7913$Y96.78035@news.rdc2.occa.home.com>
Tad,
Thanks for the tips. I will get right on it.
Matt
Tad McClellan <tadmc@metronet.com> wrote in message
news:9rkpt7.11q.ln@magna.metronet.com...
> Matt Hadder (reply@the.ng) wrote:
>
> : I was looking for advice. I just changed jobs recently. At my old job
I
> : wrote mainly in Unix C Shell. I am a decent csh programmer. My new
> : position is in a group developing in Perl. The function of the programs
I
> : will be writing will be the same or very similar to what I have done in
the
> : past. Also, I have inherited the task of porting a set of automation
> : scripts from csh to Perl.
>
> : My questions:
>
> : Is there some good documentation for avoiding pitfalls when coming from
> : another language to Perl?
>
>
> perldoc perltrap
>
> Especially the "Shell Traps" section.
>
>
>
> [ The first thing you should realize about Perl is that it
> *comes with* good documentation ( >1000 pages) for most
> everything.
>
> 'perldoc' is a program that also comes with perl. It looks
> things up in the standard documentation for you.
>
> So the above is the Perlish way to say:
>
> "You should read the perltrap.pod standard Perl doc"
> ]
>
>
> : Does anyone have advice as to the approach to take or things to avoid
when
> : porting from csh to Purl?
>
>
> perldoc perltrap # again :-)
>
>
> --
> Tad McClellan SGML Consulting
> tadmc@metronet.com Perl programming
> Fort Worth, Texas
------------------------------
Date: Sun, 10 Oct 1999 02:13:47 +0200
From: Ricardo Kustner <rix@removethis.xs4all.nl>
Subject: Perl & Sockets
Message-Id: <37FFDA3B.E1EC45E8@removethis.xs4all.nl>
Hi,
I've written (=cut&pasting from perl examples with only a bit of
thinking from my own side :) ) a simple TCP server in perl that
accepts connections on a certain port and continiously outputs
data to the client (on the client side is a Java applet)...
for each connection, a new child is being forked and it loops
endlessly untill the process is being 'reaped'...
it works fine... except, in some cases i've noticed that the
a process never goes away if the client side is gone (i guess
it doesnt do a clean TCP disconnect)... netstat -an on the
server side shows those connections as "CLOSE", and a 'ps' shows
the child process still running... and they never
go away untill i kill the main server process :(
Below a bit of my code... does anybody know what i'm doing
wrong? I tried playing around with $SIG{ALRM} but i don't really
know how to implement it in my code...
Also, does any know good books (preferrably O'reilly) on
Perl Socket programming? (and i don't mean 3 pages with examples
you can find in almost any Perl book)
Thanks in advance,
Ricardo.
==========
use Socket;
use Carp;
my $port = 1234;
my $proto = getprotobyname('tcp');
socket(Server, PF_INET, SOCK_STREAM, $proto) or die "socket: $!";
# i understand you can set a certain timeout with setsockopt somehow,
# but haven't found info on how to do that anywhere :(
setsockopt(Server, SOL_SOCKET, SO_REUSEADDR, pack("l", 1)) or die
"setsockopt: $!";
bind(Server, sockaddr_in($port, INADDR_ANY)) or die "bind: $!";
listen(Server, SOMAXCONN) or die "listen: $!";
# copied from my perl bible
sub REAPER {
$waitedpid = wait;
$SIG{CHLD} = \&REAPER; # if you don't have sigaction(2);
}
$SIG{CHLD} = \&REAPER;
for ( $waitedpid = 0;
($paddr = accept(Client,Server) || $waitedpid);
$waitedpid = 0, close Client) {
next if $waitedpid and not $paddr;
my ($port,$iaddr) = sockaddr_in($paddr);
my $name = gethostbyaddr($iaddr,AF_INET);
spawn sub {
# this is a perl hack to simulate a 'tail -f'
# on a growing log file... so, basically the client
# can watch the log grow untill the end of time
open(F, $log);
seek(F,0,2); # go to EOF
for (;;) { # forever
while(<F>) { print; }
sleep(1);
seek(F,0,1); # clear EOF error
}
}
}
sub spawn {
my $coderef = shift;
my $pid;
if (!defined($pid = fork)) {
logmsg "cannot fork: $!";
return;
} elsif ($pid) {
logmsg "begat $pid";
return; # i'm the parent
}
# else i'm the child -- go spawn
open(STDOUT, ">&Client") or die "can't dup client to stdout";
## open(STDIN, "<&Client") or die "can't dup client to stdin";
## open(STDERR, ">&STDOUT") or die "can't dup client to stderr";
exit &$coderef();
}
------------------------------
Date: 10 Oct 1999 01:08:45 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Perl CGI/Browser Output Bug - Help!
Message-Id: <slrn7vvppj.3ul.efflandt@efflandt.xnet.com>
On Thu, 07 Oct 1999 14:42:12 -0400, Carlo Mantini <carlo.mantini@fmr.com>
wrote:
>I have a unique problem with a CGI script that I have been writing. The
>script runs a compiled executable and prints the output in HTML to the
>browser. When I run the script from the command line, I get the proper
>results. However, when I run the script from the page, I receive
>"Document: Done" on my frame page, but nothing is printed. When I check
>the source of the output frame page, the only thing printed are
><HTML><BODY></BODY></HTML>. Its as if the browser ignores the formatted
>output from the compiled executable in the script.
>
>The formatted output from the executable is handled via a pipe. Here it
>is below:
>open (CMD, "suncap $host $symbol |");
...
This is a "common" problem for inexperienced programmers. You are not
testing your open to see if it is successful. So you don't know why it is
failing (path?, permissions?).
--
David Efflandt efflandt@xnet.com http://www.xnet.com/~efflandt/
http://www.de-srv.com http://cgi-help.virtualave.net/
http://thunder.prohosting.com/~cv-elgin/
------------------------------
Date: Sun, 10 Oct 1999 17:42:10 +1700
From: garmark <garmark2NOgaSPAM@hotmail.com.invalid>
Subject: Printing Unique fileds of a text database-help me?
Message-Id: <11f733ec.7fe19463@usw-ex0102-011.remarq.com>
Hello,
I am working on a script using a database of info seperated by "::"
Each line has 5 fields in an array named @info.
$info[0]=name
$info[1]=catagoty
and the rest are irrelivent to the problem.
I want to be able to print each unique $info[1] and below it list all
the $info[0] in the line that contain the associated $info[0].
say this is my database:
bob::electrician::blalblabal
jim::lawyer::blalblabal
john::mechanic::blalblaba
jim:elctrician::blalbala
I want it to display:
electrician
bob
jim
lawyer
jim
mechanic
john
I think this uses push and hash features, but i don't know a thing
about them.
the way I have it know the script prints:
electrician
bob
lawyer
jim
mechanic
john
electrician
jim
I get the repeat "elecrician" input for $info[0].
So like maybe
foreach unique($info[1]) {
print "$info0";
}
but that doesn't work......
I'm stuck and i really want to get this to work, so if anyone could
point me ahand to ae FAQ or drop me a line of code to aid me, i would
be most greatful!
Please email. thanks
Blaine garrett
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: Mon, 11 Oct 1999 00:06:30 GMT
From: schinder@leprss.gsfc.nasa.gov (Paul Schinder)
Subject: Re: Receiving e-Mail Messages via Mail::POP3Client, with MacPerl.
Message-Id: <schinder-1010992006310001@c22234-b.scllg1.pa.home.com>
In article <dowd-1010991331270001@0.0.0.0>, dowd@spam-free.home.com (Sean
Dowd) wrote:
> In article <yzxL3.1761$N64.48858@dfw-read.news.verio.net>,
> schinder@leprss.gsfc.nasa.gov wrote:
>
> > Last time I looked, Mail::POP3Client wasn't platform portable. There are
> > end-of-line issues; the author doesn't seem to know that there's a
difference
> > between "\r\n" and "\015\012".
> >
> > --
> > Paul J. Schinder
> > NASA Goddard Space Flight Center
> > schinder@leprss.gsfc.nasa.gov
>
> Wow. Slammed by someone at NASA about a conversion issue. Now *that* hurts!
>
>
My apologies. Even if I was remembering right, that was a long time ago
and I should have checked the current distribution. No excuses; I was
just being an idiot.
--
Paul J. Schinder
NASA Goddard Space Flight Center
schinder@leprss.gsfc.nasa.gov
------------------------------
Date: Sun, 10 Oct 1999 09:58:11 +0100
From: Dave Cross <dave@dave.org.uk>
Subject: Re: serching flat file database
Message-Id: <XFQAOLLcQumfzNEl9HreET1GiFhs@4ax.com>
On Sat, 09 Oct 1999 18:08:11 GMT, lowdogg@my-deja.com wrote:
>I'm currently working on a script that serches a flat file database the
>database is really more like a list with two collums one collum is the
>persons first name the second collum is the persons last name, i'm try
>to creat a list that will search this data base and if the persons first
>and last name are present than I don't want it to print to the database
>casue that would just casue duplicates,and if the names are not present
>thatn I want it to print. I have tryed the grep function but that did't
>here is the source I have so far(by the way the first and last name will
>be entered via a form)
>
>
>open(DATA, ">>empdata.dat");
>
>@b = <DATA>;
>foreach $n (@b)
>{
chomp($n);
>if ($n eq "$FORM{'fname'}|$FORM{'lname'}")
>{
>print DATA "$FORM{'fname'}|$FORM{'lname'}\n";
>}
>else
>{
>}
>}
>close(DATA);
>I am using the foreach method in this version but have also tryed the
>grep function as well
>please help thanks
Each line that you're getting back from the file will have an end of
line character on the end which is causing your match to fail.
Inserting 'chomp' at the point indicated above should fix this.
hth,
Dave...
--
Dave Cross <dave@dave.org.uk>
<http://www.dave.org.uk>
------------------------------
Date: Sun, 10 Oct 1999 01:05:22 GMT
From: mag@imchat.com (Mark P.)
Subject: trouble with hash
Message-Id: <37ffe31c.92411520@news.ionet.net>
Hi, can someone point me in the right direction here? faq, doc,
whatever.
I'm using a hash and trying to populate a new array from it so I can
use those array values in my script.
The hash;
%answer = (
'1'=>['false','true','don\'t
know','pic1.gif','pic2.gif','test answer'],
'2'=>['false','true','don\'t
know','pic1.gif','pic2.gif','test answer'],
'3'=>['false','true','don\'t
know','pic1.gif','pic2.gif','test answer'], blah,blah... I'm just
testing so everythings the same.
the bad code.
@new_answer = $answer{$question_number}; # obviouly this aint workin.
I'd bore you with my other attempts but i don't want you to fall
asleep.
I've tried a whole bunch of things actually. I've searched
Dejanews, reviewed the faq, and checked some references via
reference.perl.com on hash's. I think a lot of this is zoomin right
through the old brain socket. I've had a few beers on this problem
which probably hasn't helped.<G>
I just need to be pointed to something that I can read and
hopefully understand. As always I appreciate any help.
------------------------------
Date: Sun, 10 Oct 1999 01:07:51 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: trouble with hash
Message-Id: <MPG.1269e9325c1fc54b98a066@nntp.hpl.hp.com>
In article <slrn8008dg.36a.mgjv@wobbie.heliotrope.home> on 10 Oct 1999
05:20:43 GMT, Martien Verbruggen <mgjv@wobbie.heliotrope.home> says...
> On Sun, 10 Oct 1999 01:05:22 GMT,
> Mark P. <mag@imchat.com> wrote:
...
> > @new_answer = $answer{$question_number}; # obviouly this aint workin.
>
> I know you got an answer-in-a-box on this, but I'd like to explain a
> few more things about this, and indeed point you to some documentation
>
> The answer you got is
>
> @new_answer = @$answer{$question};
>
> This will work. ...
Well, no, it won't. I know you know this; you just took your eye off
the ball. The answer he got, and which works, is:
@new_answer = @{$answer{$question}};
The rest of your post is very pertinent and correct, though.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 09 Oct 1999 18:23:48 PDT
From: David Amann <dove@abelo.com>
To: "Mark P." <mag@imchat.com>
Subject: Re: trouble with hash
Message-Id: <37FFED80.79CC9ACC@abelo.com>
Hi Mark,
"Mark P." wrote:
> Hi, can someone point me in the right direction here?
> %answer = (
> '1'=>['false','true','don\'t
> know','pic1.gif','pic2.gif','test answer'],
> '2'=>['false','true','don\'t
> know','pic1.gif','pic2.gif','test answer'],
> '3'=>['false','true','don\'t
> know','pic1.gif','pic2.gif','test answer'],
> @new_answer = $answer{$question_number};
Try
@new_answer = @{$answer{$question_number}};
Hope this helps,
-=dav
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 1034
**************************************