[16006] in Perl-Users-Digest
Perl-Users Digest, Issue: 3418 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 19 06:11:31 2000
Date: Mon, 19 Jun 2000 03:10:20 -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: <961409420-v9-i3418@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 19 Jun 2000 Volume: 9 Number: 3418
Today's topics:
Perl 5.6 Threads Documentation? <sbin@mindless.com>
Re: Perl 5.6 Threads Documentation? <dan@tuatha.sidhe.org>
Re: Perl 5.6 Threads Documentation? <Andreas.Kutschera@bln.siemens.de>
Re: Perl :) <gellyfish@gellyfish.com>
Re: Perl Install on Win98 <-EViL-DOC-@BLUR.COM>
perl vs python amitr@w-o-i.com
Re: Problem spawning process on winnt <W.Hielscher@mssys.com>
Re: Problems creating file <gellyfish@gellyfish.com>
question about flock. <zigouras@mail.med.upenn.edu>
Re: question about flock. nobull@mail.com
Redefinition of union Semun <ghooton@my-deja.com>
Re: redirection with cgi (Rafael Garcia-Suarez)
run script when i run other program? <ianc@islandnet.com>
run script when i run other program? <ianc@islandnet.com>
Re: simple array question (Tad McClellan)
Re: Sort arrays of arrays? <gellyfish@gellyfish.com>
Re: subdomain name forwarding scripts ?? (Tony L. Svanstrom)
Re: system() in WinNT4-service <W.Hielscher@mssys.com>
Re: using mail-sender with NT scheduler service <gellyfish@gellyfish.com>
Re: What the... <gellyfish@gellyfish.com>
What's the difference between a hash and an array? (David Bell)
Re: What's the difference between a hash and an array? (Abigail)
Re: What's the difference between a hash and an array? (David Bell)
Re: What's the difference between a hash and an array? (Abigail)
Re: why does this code print two spaces? <gellyfish@gellyfish.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 18 Jun 2000 21:41:07 -0700
From: Dave <sbin@mindless.com>
Subject: Perl 5.6 Threads Documentation?
Message-Id: <an8rkskvfsu99btn6pe0t4kbvr1fduhjkp@4ax.com>
I'd like to start using threads in some of my programs and I was
wondering where I could find some good sources of informaiton on the
I-Net for using Perl with threads?
Thanks
Dave
------------------------------
Date: Mon, 19 Jun 2000 07:21:38 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Perl 5.6 Threads Documentation?
Message-Id: <6Sj35.3704$Zg4.17127@news1.rdc1.ct.home.com>
Dave <sbin@mindless.com> wrote:
> I'd like to start using threads in some of my programs and I was
> wondering where I could find some good sources of informaiton on the
> I-Net for using Perl with threads?
Read the docs that come with 5.6, and read the source when that's
insufficient. That's about all there is at the moment. OTOH, threads
aren't that complex, so it's not a huge problem. (Which isn't to say that
you can't do complex things with them, of course)
Dan
------------------------------
Date: 19 Jun 2000 09:24:48 +0200
From: Andreas Kutschera <Andreas.Kutschera@bln.siemens.de>
Subject: Re: Perl 5.6 Threads Documentation?
Message-Id: <8ikhs0$n6h$1@de1bc6hd.bln.siemens.de>
Dave <sbin@mindless.com> writes:
>I'd like to start using threads in some of my programs and I was
>wondering where I could find some good sources of informaiton on the
>I-Net for using Perl with threads?
perldoc perlthrtut
If that doesn't work, your perl version is probably too old (or you
didn't install the manpages :-)
Keep in mind, however, that threads are still experimental, subject
to change, and - in version 5.6.0 - can give you problems
with the DBI modules.
ciao
--
Andreas Kutschera, Siemens Business Services DS, Tel. 030/386-28089
Nonnendammallee 101, D-13629 Berlin Fax 030/386-22934
email: Andreas.Kutschera@bln.siemens.de
A "NOSPAM" in the subject line will definitely pass my SPAM-blocker :-)
------------------------------
Date: Mon, 19 Jun 2000 09:00:00 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl :)
Message-Id: <kil35.195$My4.29502@news.dircon.co.uk>
On Sun, 18 Jun 2000 09:48:18 -0700, damonr Wrote:
> Hi,
> I am running a new site(http://www.devcritic.com) and i was
> wondering if you people knew some good Perl resource sites that
> i could add to the Perl part of the site directory:
> http://www.devcritic.com/sites/Perl/. Feel free to add any sites
> by clicking "Add a site" on the side menu or tell me here and i
> will add em to there.
>
It might be of interest to someone that the Perl content of this site
appears to be lifted directly from the the Open Directory Project's Perl
section (<http://dmoz.org/Computers/Programming/Languages/Perl/>) without
any attribution which is direct contravention of the free use license
(<http://dmoz.org/license.html>).
/J\
------------------------------
Date: Mon, 19 Jun 2000 15:10:06 +1000
From: "-EViL-DOC-" <-EViL-DOC-@BLUR.COM>
Subject: Re: Perl Install on Win98
Message-Id: <394dac9b$1@ns1.access1.com.au>
Why reinvent the wheel ?
Goto www.worldwidemart.com/scripts & use/customise that formmail
Bob Gregory <bgregory3@cs.com> wrote in message
news:394ba3e7$1@news.piro.net...
> Mösl
> this was a good tip. I forgot about version 612 and downloaded
ActivePerl
> v522 and Apache Web Server for windows and started learning Perl. I am
> having problems with the installation, because I can write a script,
execute
> it in a dos window (eg something simple like print a message 10 times),
but
> I want to have a form written in html which executes a perl program which
> takes the fields in the form as input (e.g. ordering a product xyz,and
> returns the data formatted (e.g. thank you for ordering xyz). the perl
> program sends the reply to the dos window instead of to the Win IE
browser.
> I am assuming that when the Apache Web server software is running that it
> picks up the output from the Perl programm.
> This is very difficult to debug, but have you got any suggestions how I
> could home in on the error?
>
> ps: I see from your web site that you are from Austria. I live in
Cologne,
> Germany, and will be in Wallsee (between Linz and Yibbs on the Donau) end
> July!
>
>
> Mösl Roland <founder@pege.org> wrote in message
> news:393a880c$0$20856@SSP1NO17.highway.telekom.at...
> > "Bob Gregory" <bgregory3@cs.com> wrote in message
> > news:393a7925@news.piro.net...
> > > I have tried to install Perl on my PC under Win98 in order to write
and
> > test
> > > Perl scripts & programms. I downloaded Active Perl 613 für Windows
> 95/98
> > > (InstMsi.exe) from http://www.activestate.com/ActivePerl. When I
> execute
> > it
> > > nothing happens, i.e. no error messages, but no sign of a correct Perl
> > > installation. Can anyone help me get Perl installed under Win 98? My
> > > target server is Windows NT (private) and Unix (work)
> >
> > I work with Active Perl 522
> >
> > I tested 613, but did not work as PerlScript
> > on my old Win95 system.
> >
> > I hope for 614 to fix some small bugs.
> >
> >
> > --
> > Mösl Roland http://www.pege.org
> > Clear targets for a confused civilization
> > http://www.BeingFound.com
> > web design and seminars
> > +43 699 17343674
> >
> >
> >
>
>
------------------------------
Date: Mon, 19 Jun 2000 07:07:06 GMT
From: amitr@w-o-i.com
Subject: perl vs python
Message-Id: <8ikgqp$2hs$1@nnrp1.deja.com>
hi
is python better than perl? I have been using perl for web
developement. But all of a sudden people talking about python.
any advice?
what are the strong points and disadvantages?
thanks
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 19 Jun 2000 10:27:19 +0200
From: Wolfgang Hielscher <W.Hielscher@mssys.com>
Subject: Re: Problem spawning process on winnt
Message-Id: <394DD967.C211A8F6@mssys.com>
"Ing. R. Uittenbosch" wrote:
> When I put all in a batch file like :
> <<< test.bat >>>
> cd h:\projects\Validate\testdir
> perl h:\Projects\Validate\Bin\realtest.pl parameter parameter
> >>>
For starting batch files from my Perl scripts, I usually use
$rc = system( "START /B c:\\test\\test.bat" );
$rc == 0 or die("system() failed returning $rc indicating $!");
(Please see documentation of system() for more information on the
return-value of system().)
"START" brings up a new shell for executing your batch file, so the
system()-call
won't wait for the batch file to finish.
By using "/B" you don't get another Shell Window. For some more
informations on "START" just type "START /?" on the commandline.
HTH
Cheers
Wolfgang
------------------------------
Date: 18 Jun 2000 22:16:38 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Problems creating file
Message-Id: <8ije7m$fgi$1@orpheus.gellyfish.com>
On Fri, 16 Jun 2000 10:02:58 +0200 Johannes wrote:
> Abel Almazan wrote:
>
>>
>> I use this sentence:
>>
>> open OUT,"> ../public_html/news_es.html";
>>
>> and i want this to create a new file named news_es.html, and then write
>> on it.
>>
>> But this sentence doesn't create the file if i execute the script from
>> browser.
>> If the file is created previously, then this sentence opens it and i can
>> write on.
>>
>> What happens?? Problems of permissions??
>>
>
> This sound like a problem with the permissions, insert an error handling:
>
> open OUT, "> ../public_html/news_es.html" or die "Can't create file: $!";
>
> You can find the error messages in the error.date log file.
>
If the file can be written to and read from but not created then it is
most probably an issue with the permissions on the directory. But yes
the diagnostic message should provide the clue.
/J\
--
** This space reserved for venue sponsor for yapc::Europe **
<http://www.yapc.org/Europe/>
------------------------------
Date: Mon, 19 Jun 2000 01:34:45 -0400
From: Nico Zigouras <zigouras@mail.med.upenn.edu>
Subject: question about flock.
Message-Id: <Pine.OSF.4.21.0006190131230.12369-100000@mail.med.upenn.edu>
Hello:
I am a little confused about flock(). I have tried both on Solaris and
RedHat 5.2 to lock a file. While the lock is on the file I open a
separate handle to the file and try to write to it. If the lock worked I
would assume that I would not be able to write to the file
simultaneously. However, I can write to it. Can anyone explain to me
what I am doing wrong? Pointers to docs on the web to help me would be
appreciated. I am attaching a snippet of code which I used to
test it. It is essentially the example from the perldoc -f flock
documentation. Thanks in advance.
#!/usr/bin/perl
use Fcntl ':flock'; # import LOCK_* constants
sub lock {
flock(MBOX,LOCK_EX);
# and, in case someone appended
# while we were waiting...
seek(MBOX, 0, 2);
}
sub unlock {
flock(MBOX,LOCK_UN);
}
open(MBOX, ">>test_flock.txt")
or die "Can't open mailbox: $!";
lock();
open( F, ">test_flock.txt") || die("Can't open it again: $!");
print F "hello2";
close F;
print MBOX "hello\n\n";
unlock();
------------------------------
Date: 19 Jun 2000 09:29:33 +0100
From: nobull@mail.com
Subject: Re: question about flock.
Message-Id: <u94s6qgjki.fsf@wcl-l.bham.ac.uk>
Nico Zigouras <zigouras@mail.med.upenn.edu> writes:
> I am a little confused about flock().
Not a Perl issue. Perl's flock() is just an interface to Unix's flock().
> I have tried both on Solaris and
> RedHat 5.2 to lock a file. While the lock is on the file I open a
> separate handle to the file and try to write to it.
Check the Unix man page for flock. Note: "A file is locked (i.e., the
inode), not the file descriptor". Note also from "perldoc -f flock"
"files locked with flock() may be modified by programs that do not
also use flock()".
Either of these is sufficient to account for why you don't observe
mandatory locking between different descriptors in the same process.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Mon, 19 Jun 2000 04:21:17 GMT
From: Gordon Hooton <ghooton@my-deja.com>
Subject: Redefinition of union Semun
Message-Id: <8ik73o$t3h$1@nnrp1.deja.com>
I am trying to install PerlMagick on a Linux sytem. When "making" I get
an error in perl.h (line 2546) stating "redefinition of union senum"
I see this is caused by an "# ifndef HAS_UNION_SEMUN" construct.
The perl is version 5.00503
Has anyone any suggestions.
Thanks -Gordon
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 19 Jun 2000 06:55:01 GMT
From: garcia_suarez@hotmail.com (Rafael Garcia-Suarez)
Subject: Re: redirection with cgi
Message-Id: <slrn8krh5m.ui0.garcia_suarez@rafael.kazibao.net>
metza@my-deja.com wrote in comp.lang.perl.misc:
>Hi,
>
>I'm new to perl, and I was writing a cgi script that after accepting form
>input displays a thank you message. I know I can produce this thankyou
>message using the print command, but I want be quite a complex looking page.
>What I would prefer to do, is instead of writing a message out using the
>print command, is indirect the user to a pre-prepared standard thank you
>message page. Can I do this?
Use the redirect method from the CGI module:
my $q = new CGI();
#...
print $q->redirect('http://my.new.url/');
This outputs a redirection header. Hence, you must not print a
"Content-type: " header if you want this to work.
--
Rafael Garcia-Suarez
------------------------------
Date: Sun, 18 Jun 2000 22:31:03 -0700
From: ian_campbell <ianc@islandnet.com>
Subject: run script when i run other program?
Message-Id: <394DB017.B763EB4D@islandnet.com>
I'd like to run this script that uploads a text file to my homepage
automatically every day. is there a way for it to
run when i am online, or perhaps when i start netscape? (using: win98 /
dialup)
thanks
------------------------------
Date: Sun, 18 Jun 2000 22:33:43 -0700
From: ian_campbell <ianc@islandnet.com>
Subject: run script when i run other program?
Message-Id: <394DB0B7.1026EACA@islandnet.com>
I'd like to run this script that uploads a text file to my homepage
automatically every day. is there a way for it to
run when i am online, or perhaps when i start netscape? (using: win98 /
dialup)
thanks
------------------------------
Date: Sun, 18 Jun 2000 23:25:32 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: simple array question
Message-Id: <slrn8kr4lc.d0s.tadmc@magna.metronet.com>
On Mon, 19 Jun 2000 11:07:24 +1000, Phil Sutcliffe <ils@gil.com.au> wrote:
>Thanks for the reply, but it doesn't really answer my question.
And that is a good thing!
Friends don't let friends use symrefs.
>What I need is to get the data "GBH" "QLD" "1234" into variables called
>$company $state and $postcode.
($company, $state, $postcode) = qw/ GBH QLD 1234 /;
>I am modifying existing code and the task to change every occurance of
>$company to $details{company} will not be a trivial one.
perl -p -i.badrefs -e 's/\$company\b/\$details{company}/g' file1 file2...
That did not seem non-trivial...
>Do you have any other suggestions?
You don't wear a seat belt in the car either, do you?
[ snip 80 lines of Jeopardy quoted text about "wanting" to
use symbolic references.
]
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 18 Jun 2000 22:27:27 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Sort arrays of arrays?
Message-Id: <8ijerv$hj3$1@orpheus.gellyfish.com>
On Fri, 16 Jun 2000 10:37:52 -0400 Drew Simonis wrote:
> "Henrik Jönsson" wrote:
>>
>> I inserted the url and numberOfHits in an array. But how do I sort
>> this array?
>>
>> Is there a better way to do this?
>
> Maybe use a hash instead of an array?
Well, yes, but he would still have to arrange to sort it by the values
at some point. Of course at that point he could read the entry in perlfaq4:
How do I sort a hash (optionally by value instead of key)?
/J\
--
** This space reserved for venue sponsor for yapc::Europe **
<http://www.yapc.org/Europe/>
------------------------------
Date: Mon, 19 Jun 2000 10:57:15 +0200
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: subdomain name forwarding scripts ??
Message-Id: <1ecgzmo.18gc9ev1pwwyioN%tony@svanstrom.com>
Ramya <omygod@my-deja.com> wrote:
> Hi,
> I am not sure a javascript can do this or you need a cgi/perl script but
> here is what I am looking for. I have a domain name www.myname.com and I
> want to create subdomain names like music.myname.com , geek.myname.com
> etc. which in turn will be pointing to www.myname.com/music and
> www.myname.com/geek for there respective index pages. Could anybody
> suggest any sites with such scripts even for a nominal fee.
It is possible to do that with JavaScript/InScript/ECMAscript, but you
don't want to limit yourself by using JavaScript... I could put together
a very small and simple CGI-script (in Perl) for you that does just what
you want.
/Tony
--
/\___/\ Who would you like to read your messages today? /\___/\
\_@ @_/ Protect your privacy: <http://www.pgpi.com/> \_@ @_/
--oOO-(_)-OOo---------------------------------------------oOO-(_)-OOo--
DSS: 0x9363F1DB, Fp: 6EA2 618F 6D21 91D3 2D82 78A6 647F F247 9363 F1DB
---ôôô---ôôô-----------------------------------------------ôôô---ôôô---
\O/ \O/ ©1999 <http://www.svanstrom.com/?ref=news> \O/ \O/
------------------------------
Date: Mon, 19 Jun 2000 09:52:16 +0200
From: Wolfgang Hielscher <W.Hielscher@mssys.com>
Subject: Re: system() in WinNT4-service
Message-Id: <394DD130.40D6DD6D@mssys.com>
Tom Phoenix wrote:
> If rebooting helps a Perl program, there's probably a problem at the OS
> level. There's probably nothing you can do at the Perl level which will
> fix things. Oh, well!
Hmmm, so my posting was too long (and boring?) that it didn't make clear
what I'm asking for.
I know that I definitely got a problem at the OS level and I don't want
to fix it on the Perl level. Making this clear was my intention for
telling you "the whole story" in the first posting.
So I politely repeat my question:
So, does anyone know under which circumstances the system()-function
fails?
Cheers
Wolfgang
------------------------------
Date: 19 Jun 2000 07:59:54 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: using mail-sender with NT scheduler service
Message-Id: <8ikgda$ejq$1@orpheus.gellyfish.com>
On Fri, 16 Jun 2000 06:41:42 GMT Mark Meyer wrote:
> hello david..
>
> thx for replying to my query so quickly..i appreciate it..
>
>>Without more info, I'll still take a guess that you may be thinking
>>this because the application seems to start but then immediately
>>exits? It's more likely that perhaps something is failing in the
>>script when run from the scheduler and that failure is terminating the
>>script.
>
>
> you were correct
>
>
>>What you might try is putting a 'pause' at the end of the batch file.
>>That way if there are some errors being displayed you should have a
>>chance to see them.
>
>
> this was very helpful ...i found the error using pause.
>
I assume that you found that the problem was due to the user that the
schedule service runs as had no rights to the network that is needed
to make the SMTP connection. It is nice if people post back the resolution
to their problem so people experiencing a similar problem can find it
by searching the various archives of the group.
/J\
--
** This space reserved for venue sponsor for yapc::Europe **
<http://www.yapc.org/Europe/>
------------------------------
Date: Mon, 19 Jun 2000 08:46:53 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: What the...
Message-Id: <16l35.194$My4.29619@news.dircon.co.uk>
On Sun, 18 Jun 2000 17:31:38 -0700, Agentkhaki Wrote:
> Perhaps someone can help me out here.
>
> Go to http://www.agentkhaki.com/xero/cgitest.html and fill
> in the form with bogus info, and click submit. Why am I
> getting this?
>
No you explain to us the Perl problem you have and we will answer it.
/J\
------------------------------
Date: 19 Jun 2000 04:52:27 GMT
From: db7654321@aol.comspamsux (David Bell)
Subject: What's the difference between a hash and an array?
Message-Id: <20000619005227.02964.00001073@ng-ch1.aol.com>
Hello! I've got another simple question. :) What's the difference between a
hash and an array? I've tried to make a program that'll remove the username of
the user running the program from a hash, but I can't quite get it to work
right. I'm getting the error: Odd number of elements in hash assignment at
./test line 6, <USER> chunk 1. ... Here's the code:
#!/usr/bin/perl -w
use strict;
my $userfile = "/home/david/perl/users";
chomp(my $userinfo = `id -un`) or die "Can't execute id -un $!\n";
open(USER, $userfile) or die "Can't open $userfile $!\n";
my %user = <USER>;
close(USER) or die "can't close $userfile: $!\n";
delete $user{$userinfo};
open(WRITE, ">$userfile") or die "can't open $userfile $!\n";
my @list = keys(%user);
print WRITE @list;
if (%user) {
print "\n\tSomeone is still using the internet.\n\n";
} else {
# system("/usr/bin/killpppnow") or die "Can't execute killpppnow $!\n";
print "\n\You're now disconnected from the internet.\n\n";
}
close(WRITE) or die "Can't close $userfile $!\n";
As you can see, the hash is $userfile (or it should be). The format of
$userfile is one name (just the username.) per line. It should then remove
$userinfo from the hash, this doesn't work either. When the hash is empty, it
should follow the else {} commands. I'm sure this is just a simple error on my
part... All help is appreceated!
-------------------------
David Bell - Otherwise known as DB7654321
Remember to remove nospam, notrash or anything odd looking from my email
address. :)
------------------------------
Date: 19 Jun 2000 01:16:54 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: What's the difference between a hash and an array?
Message-Id: <slrn8krc8b.3a7.abigail@alexandra.delanet.com>
David Bell (db7654321@aol.comspamsux) wrote on MMCDLXXXIV September
MCMXCIII in <URL:news:20000619005227.02964.00001073@ng-ch1.aol.com>:
;; Hello! I've got another simple question. :) What's the difference between
;; hash and an array? I've tried to make a program that'll remove the username
;; the user running the program from a hash, but I can't quite get it to work
;; right. I'm getting the error: Odd number of elements in hash assignment at
;; ./test line 6, <USER> chunk 1. ... Here's the code:
;;
;; #!/usr/bin/perl -w
;; use strict;
;; my $userfile = "/home/david/perl/users";
;; chomp(my $userinfo = `id -un`) or die "Can't execute id -un $!\n";
;; open(USER, $userfile) or die "Can't open $userfile $!\n";
;; my %user = <USER>;
;; close(USER) or die "can't close $userfile: $!\n";
;; delete $user{$userinfo};
;; open(WRITE, ">$userfile") or die "can't open $userfile $!\n";
;; my @list = keys(%user);
;; print WRITE @list;
;; if (%user) {
;; print "\n\tSomeone is still using the internet.\n\n";
;; } else {
;; # system("/usr/bin/killpppnow") or die "Can't execute killpppnow $!\n";
;; print "\n\You're now disconnected from the internet.\n\n";
;; }
;; close(WRITE) or die "Can't close $userfile $!\n";
;;
;;
;; As you can see, the hash is $userfile (or it should be). The format of
Hashes start with a %. $userfile is a scalar, holding the name of a file.
;; $userfile is one name (just the username.) per line. It should then remove
;; $userinfo from the hash, this doesn't work either. When the hash is empty, i
;; should follow the else {} commands. I'm sure this is just a simple error on
;; part... All help is appreceated!
<USER> in list context returns a list consisting of the lines of a file.
So, you create %user where you use the odd numbered lines as keys,
and the even numbered lines as values. Not at all what you want.
You get the warning because there are an odd number of lines in the file.
If you want to use a hash in this situation, do something like:
my %user = map {$_ => 1} <USER>;
or
my %user;
@user {<USER>} = ();
There is, however, no need for the hash.
my @list = grep {!/^\Q$userinfo\E$/} <USER>;
will do.
Also note that the program doesn't lock the files, hence you will be in
serious trouble if multiple instance of the program run at the same time.
Furthermore, why call the external id program, if you could use Perl
primitives?
my $userinfo = getpwuid $<;
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
------------------------------
Date: 19 Jun 2000 06:06:50 GMT
From: db7654321@aol.comspamsux (David Bell)
Subject: Re: What's the difference between a hash and an array?
Message-Id: <20000619020650.02964.00001095@ng-ch1.aol.com>
OK, looks like it's working! I think I over-complicated the script the first
time... No need for an array. Thanks. :) About the lack of file locks...
What *would* happen if two people ran the script at the same time? Thanks
again!
-------------------------
David Bell - Otherwise known as DB7654321
Remember to remove nospam, notrash or anything odd looking from my email
address. :)
------------------------------
Date: 19 Jun 2000 02:19:11 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: What's the difference between a hash and an array?
Message-Id: <slrn8krft5.3a7.abigail@alexandra.delanet.com>
David Bell (db7654321@aol.comspamsux) wrote on MMCDLXXXIV September
MCMXCIII in <URL:news:20000619020650.02964.00001095@ng-ch1.aol.com>:
\\
\\ About the lack of file locks...
\\ What *would* happen if two people ran the script at the same time?
Data corruption. Loss of information.
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
------------------------------
Date: 19 Jun 2000 08:18:56 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: why does this code print two spaces?
Message-Id: <8ikhh0$i8s$1@orpheus.gellyfish.com>
On Thu, 15 Jun 2000 22:33:51 GMT mark rowlands wrote:
> my %ch_pports = map {$_ => 1} @ch_pports;
> my %oh_pports = map {$_ => 1} @oh_pports;
> my @new = grep {!$ch_pports {$_}} @oh_pports;
> my @gone = grep {!$oh_pports {$_}} @ch_pports;
>
> print "@gone has disappeared from $ch_here\n";
> Print "@new has shown up at $oh_here\n";
>
> #foreach $new (@new) {print "|$new|\n";}
> #foreach $gone (@gone) {print "|$gone|\n";
>
> rather helpfully, when something has appeared, I also get a line,
> where appropriate, telling me that nothing has disappeared and vice
> versa. for example
>
> 199.open.tcp.unknown. has shown up at 129.145.123.123
> gone from 129.145.123.123 #e.g. nothing has gone!
> new at 129.xxx.xxx.121
> 3421.open.tcp.unknown. 3421.open.udp.unknown. gone from 129.123.249.121
>
> Could anyone a) enlighten me as to how can I suppress the
>
> "blankblankgone....."
> "blankblanknew......"
> lines?
>
> and for optional good karma :b) Explain in simple syllables why this is
> happening : it's my second perl program so please be gentle, I am
> trying to learn.
>
I'm still not clear what the problem is but the crystal ball seems to
suggest that you are experiencing the effects of array interpolation in
a double quoted string - you might want to look at perlfaq5 :
Why do I get weird spaces when I print an array of lines?
When an array is interpolated into a double quoted string the elements
are separated by whatever is in the variable $" - by default a space.
You can set this to whatever you want - probably localizing the
assignment in a block so as not to screw up other parts of the code
that might rely on it :
{
local $" = '';
# interpolate some arrays
}
# $" back to normal here.
/J\
/J\
--
** This space reserved for venue sponsor for yapc::Europe **
<http://www.yapc.org/Europe/>
------------------------------
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 3418
**************************************