[7651] in Perl-Users-Digest
Perl-Users Digest, Issue: 1277 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 6 00:08:10 1997
Date: Wed, 5 Nov 97 21:00:21 -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, 5 Nov 1997 Volume: 8 Number: 1277
Today's topics:
Re: 'sort'ing umlauts (Michael Schuerig)
Re: +>> should work, why doesn't it. :-( (Mike King)
5.004_04 & Solaris 2.5.1: redef test fails (Roy S. Rapoport)
Re: Bug in 5.004_01 Solaris 2.5.1/SPARC fork() and EOF <rootbeer@teleport.com>
Declare hash of hashes in Perl4 (Wei Tang)
Re: Declare hash of hashes in Perl4 <doug@tc.net>
Re: Declare hash of hashes in Perl4 (Eric Bohlman)
Diff. between Oraperl & DBI/DBD for Oracle (jamester)
How to send mail w/in Perl program? (Joseph O'Rourke)
Re: How to send mail w/in Perl program? <doug@tc.net>
interrupt system("$cmd") if timeout <helina@torus.eng.yale.edu>
Re: Perl 5.004_04 is available (Maintenance Release 4 f (Colin Kuskie)
Re: Protecting Perl Source (Mike King)
Regex question <ahecker@interport.net>
Re: Sorting and Counting with PERL <ludlow@us.ibm.com>
Re: Sorting and Counting with PERL (brian d foy)
Re: Sorting and Counting with PERL (Brian Kendig)
Re: unset an array <justin@nectar.com.au>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 6 Nov 1997 01:48:29 +0100
From: uzs90z@ibm.rhrz.uni-bonn.de (Michael Schuerig)
Subject: Re: 'sort'ing umlauts
Message-Id: <199711060014486468760N@rhrz-isdn3-p26.rhrz.uni-bonn.de>
Randy Jay Yarger <randy@hs1.hst.msu.edu> wrote:
> I'm trying to figure out a way to sort a list of names which contain some
> characters with umlauts. The character with the umlaut should appear after
> the corresponding character without. So with the list:
Sorry, I don't have the solution, just a note from germany. I had a look
at my phone book and there umlauts are sorted like their two-character
circumscription, i.e. "(ae)" is sorted as "ae". OTOH, my german
dictionary (Duden) ignores the umlaut-ness and sorts "(ae)" the same as
"a".
Michael
--
Michael Schuerig Consistency is the last refuge
mailto:uzs90z@uni-bonn.de of the unimaginative.
http://www.uni-bonn.de/~uzs90z/ -Oscar Wilde
------------------------------
Date: Thu, 06 Nov 1997 02:20:24 GMT
From: m.king.garbage@praxa.garbage.com.au (Mike King)
Subject: Re: +>> should work, why doesn't it. :-(
Message-Id: <34611ed4.90731665@news.ozemail.com.au>
On Thu, 30 Oct 1997 15:22:19 -0800, Matt McLaughlin <raven@lp-llc.com>
wrote:
>Trying to access a list and append (add to) it.
>
>When I access it from my SHELL, it works great.
>
>When I access it from the web "can't open list to append Permission
>denied"
>
>Isn't "+>>" supposed to give anyone permission? or am I just reading the
>blue camel wrong
>
>Here's how the code looks:
>
>open (LIST, "+>>$LIST")|| print "Content-type: text\/html\n\n can't open
>list to append $!";
>
> print LIST "$you";
>
>close(LIST);
It is because the cgi process probably runs as 'nobody', who will not
have permission to write your files.
You need to either relax your protection (chmod +w xxx), or get your
web administrator to set the CGI to run as your uid. (In apache it is
the suexec wrapper.
Mike
------------------------------
Date: 5 Nov 1997 20:44:44 -0800
From: rsr@best.com (Roy S. Rapoport)
Subject: 5.004_04 & Solaris 2.5.1: redef test fails
Message-Id: <63rhvs$esl$1@shell3.ba.best.com>
Solaris 2.5.1, patched, trying to compile perl 5.004.04:
A) During the compile phases, I see bunch of
Prototype mismatch: sub ExtUtils::MakeMaker::prompt ($;$) vs ($;$) at (eval 1)
line 29.
When making various packages;
B) During make test, I get
comp/redef........FAILED at test 0
...
lib/opcode........Prototype mismatch: sub Opcode::opset_to_hex ($) vs ($) at
../lib/Opcode.pm line 40.
Prototype mismatch: sub Opcode::opdump (;$) vs (;$) at ../lib/Opcode.pm line
50.
ok
lib/open2.........ok
lib/open3.........ok
lib/ops...........Prototype mismatch: sub Opcode::opset_to_hex ($) vs ($) at
../lib/Opcode.pm line 40.
Prototype mismatch: sub Opcode::opdump (;$) vs (;$) at ../lib/Opcode.pm line
50.
ok
lib/parsewords....ok
lib/posix.........ok
lib/safe1.........Prototype mismatch: sub Opcode::opset_to_hex ($) vs ($) at
../lib/Opcode.pm line 40.
Prototype mismatch: sub Opcode::opdump (;$) vs (;$) at ../lib/Opcode.pm line
50.
ok
lib/safe2.........Prototype mismatch: sub Opcode::opset_to_hex ($) vs ($) at
../lib/Opcode.pm line 40.
Prototype mismatch: sub Opcode::opdump (;$) vs (;$) at ../lib/Opcode.pm line
50.
ok
And finally, when I went into t and did ./perl harness, I got (after the long
output):
Failed Test Status Wstat Total Fail Failed List of failed
-------------------------------------------------------------------------------
comp/redef.t 0 139 ?? ?? % ??
Failed 1/153 test scripts, 99.35% okay. 0/4589 subtests failed, 100.00% okay.
I'm not sure I understand how it could fail 1 out of the test scripts, but none
of the subtests.
Should I just ignore this?
-roy
------------------------------
Date: Wed, 5 Nov 1997 17:06:51 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: David C Niemi <niemi@tux.org>
Subject: Re: Bug in 5.004_01 Solaris 2.5.1/SPARC fork() and EOF handling?
Message-Id: <Pine.GSO.3.96.971105165439.6157J-100000@usertest.teleport.com>
On Wed, 5 Nov 1997, David C Niemi wrote:
> When the parent script gets to EOF of the configuration file, it does
> not realize it has gotten there and starts reading fragmentary lines
> from farther up in the file.
That shouldn't be happening, no doubt about it.
> Immediately closing the configuration file in the child processes does
> not help, but if I bypass the guts of the child program the EOF is seen
> normally.
That seems to indicate that something in those "guts" is doing something
it shouldn't. Closing the file from the child process should suffice,
though. AFAIK.
> open ('userconf', "$USERCONF") || die "Can't open $USERCONF: $!";
Preferably, filehandle names should be all caps.
> while (<userconf>) {
> chop;
Why not chomp?
> s/^\s*//; ## Eliminate leading whitespace
> s/\s*$//; ## Eliminate trailing whitespace
> s/^\#.*//; ## Eliminate comments
If you strip the comments first, that makes more sense. In fact, as long
as you're getting rid of trailing whitespace, you needn't chomp, either.
But it's faster to use + instead of * when stripping whitespace.
> unless (fork) { ## START CHILD PROCESS ##
Red alert! You're assuming that the fork succeeded. You should always
check the return value of fork, to see whether it's defined.
> #### child opens, flocks, and closes a number files
> #### unrelated to $USERCONF, and makes a number of
> #### calls to system()
(What's $USERCONF :-) Any chance that the elided code uses 'last' or
'next' somewhere? (The child could accidentally be executing the parent's
code.)
> exit 0; ## Exit from child process
> } ## END CHILD PROCESS ##
> sleep 5;
That's five seconds of your life that you'll never get back. :-) If you
check that fork succeeds (which you should be doing anyway) there's no
reason to slow this down. Unless you want to be nice, in which case you
should set your priority, or use nice(1).
> }
>
> ## Wait for children to finish
> while (($cpid = wait) > -1) {
> &debug("$0: Reaping child PID $cpid...\n");
> }
Probably better to use waitpid and catch them each time through the loop,
and get any stragglers here at the end.
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 6 Nov 1997 01:52:43 GMT
From: wtang@cs.ualberta.ca (Wei Tang)
Subject: Declare hash of hashes in Perl4
Message-Id: <63r7tb$hn2$1@scapa.cs.ualberta.ca>
Hi, there:
For some reason, I am still using Perl4. But I don't know how to declare
Hash of Hashes.
I have tried the example from perldsc man page:
%HoH = (
flintstones =>{
lead => "fred",
pal => "barney",
},
jetsons =>{
lead => "george",
wife => "jane",
},
);
foreach $family ( keys %HoH ) {
print "$family: { ";
for $role ( keys %{ $HoH{$family} } ) {
print "$role=$HoH{$family}{$role} ";
}
print "}\n";
}
But I got compiling error at "=>" which seems that Perl4 doesn't know
"=>" while it succeeded when I tried Perl5. It does me no good when I
change "=>" to "," because I got another error at ",{". This time I
change ",{" to ",(" and "}," to "),", I got no errors, but the output
seems incorrect:
lead: { }
barney: { }
fred: { }
flintstones: { }
wife: { }
It's not what I wanted.
Could somebody help me out? Please do not just suggest me to use Perl5
instead of Perl4. I have to use Perl4 to do the job.
Thanks.
------------------------------
Date: 05 Nov 1997 21:35:33 -0500
From: Douglas McNaught <doug@tc.net>
To: wtang@cs.ualberta.ca (Wei Tang)
Subject: Re: Declare hash of hashes in Perl4
Message-Id: <m24t5qycju.fsf@ono.tc.net>
[mailed and posted]
wtang@cs.ualberta.ca (Wei Tang) writes:
> Hi, there:
>
> For some reason, I am still using Perl4. But I don't know how to declare
> Hash of Hashes.
>
> I have tried the example from perldsc man page:
[...]
> Could somebody help me out? Please do not just suggest me to use Perl5
> instead of Perl4. I have to use Perl4 to do the job.
The data structure you're trying to use depends on references, which
are not part of Perl 4, period. You will have to try to use another
data structure that is supported by Perl 4 if you can't upgrade.
-Doug
--
sub g{my$i=index$t,$_[0];($i%5,int$i/5)}sub h{substr$t,5*$_[1]+$_[0],1}sub n{(
$_[0]+4)%5}$t='encryptabdfghjklmoqsuvwxz';$c='fxmdwbcmagnyubnyquohyhny';while(
$c=~s/(.)(.)//){($w,$x)=g$1;($y,$z)=g$2;$w==$y&&($p.=h($w,n$x).h($y,n$z))or$x==
$z&&($p.=h(n$w,$x).h(n$y,$z))or($p.=h($y,$x).h($w,$z))}$p=~y/x/ /;print$p,"\n";
------------------------------
Date: Thu, 6 Nov 1997 02:44:18 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Declare hash of hashes in Perl4
Message-Id: <ebohlmanEJ7E9u.vu@netcom.com>
Wei Tang (wtang@cs.ualberta.ca) wrote:
: Hi, there:
: For some reason, I am still using Perl4. But I don't know how to declare
: Hash of Hashes.
Unfortunately for you, Perl 4 doesn't support references, which are
essential for creating complex data structures ( {key1=>val1,key2=>val2}
creates a reference to a hash with two keys. This reference can be stored
anywhere a scalar can, particularly in the value of another hash). It
*might* be possible to simulate an HOH in Perl 4 by means of some rather
lengthy magical incantations involving typeglobs, but it would definitely
not be pretty; remember that what you'd be doing is essentially casting
spells that are supposed to resurrect a dead camel.
------------------------------
Date: 6 Nov 1997 01:07:48 GMT
From: jamester@alumni.EECS.Berkeley.EDU (jamester)
Subject: Diff. between Oraperl & DBI/DBD for Oracle
Message-Id: <63r595$t1p$1@agate.berkeley.edu>
Hi all,
Sorry if this has been asked (and answered) before..can't seem to find it in
the FAQ.
Can someone tell me what the difference is between Oraperl and DBD/DBI for
Oracle? What are the advantages of using one to another?
I have a perl script that needs to do a simple login to the database, checks
some information into the database and log out. (no query, no fancy stuff).
Which should be easier to integrate with perl?
Thanks in advance for the help!
James
--
------------------------------
Date: 6 Nov 97 02:01:39 GMT
From: orourke@grendel.csc.smith.edu (Joseph O'Rourke)
Subject: How to send mail w/in Perl program?
Message-Id: <34612503.0@news.smith.edu>
I am using Perl 5.0 on a Unix system, and would like my program
to send me mail whose body is written from information in
variables inside the Perl program. I tried
system "mail orourke"
which does invoke mail, but then requests the "Subject" and "Body".
I tried various ways to get prints from inside the Perl program
to be accepted as input to the mail program, but I don't really know
enough Unix or Perl to do this. My unpleasant workaround is to have
the Perl program write a file that is a shell program, and then to
execute that from inside the Perl program. This is very awkward.
Any ideas would be appreciated. I've looked in some relevant FAQ's
to no avail. Thanks!
------------------------------
Date: 05 Nov 1997 21:32:20 -0500
From: Douglas McNaught <doug@tc.net>
To: orourke@grendel.csc.smith.edu (Joseph O'Rourke)
Subject: Re: How to send mail w/in Perl program?
Message-Id: <m27mamycp7.fsf@ono.tc.net>
[mailed and posted]
orourke@grendel.csc.smith.edu (Joseph O'Rourke) writes:
> I am using Perl 5.0 on a Unix system, and would like my program
> to send me mail whose body is written from information in
> variables inside the Perl program. I tried
The general practice on Unix is to open a pipe to Sendmail, and let
that venerable and baroque entitity accomplish your mail delivery.
Here's an (untested) example:
open(SENDMAIL, "|/usr/lib/sendmail -t") or
die "Pipe open failed: $!\n";
print SENDMAIL <<EOF;
From: joeblow@domain1.com
To: jimbob@domain2.com
Subject: Daily status message
This is a status message. It contains the values of the variables
$var1 and $var2.
Signed,
Your Program
EOF
close(SENDMAIL) or
warn "Error on pipe close; mail may not have been sent: $!\n";
warn "Mail delivery may have failed! Sendmail exited with status $?.\n"
if $? != 0;
-Doug
--
sub g{my$i=index$t,$_[0];($i%5,int$i/5)}sub h{substr$t,5*$_[1]+$_[0],1}sub n{(
$_[0]+4)%5}$t='encryptabdfghjklmoqsuvwxz';$c='fxmdwbcmagnyubnyquohyhny';while(
$c=~s/(.)(.)//){($w,$x)=g$1;($y,$z)=g$2;$w==$y&&($p.=h($w,n$x).h($y,n$z))or$x==
$z&&($p.=h(n$w,$x).h(n$y,$z))or($p.=h($y,$x).h($w,$z))}$p=~y/x/ /;print$p,"\n";
------------------------------
Date: Wed, 05 Nov 1997 22:41:12 -0500
From: Helina Chan <helina@torus.eng.yale.edu>
Subject: interrupt system("$cmd") if timeout
Message-Id: <34613C58.78B71D9A@torus.eng.yale.edu>
Hi,
I could not find information about interrupting
a process started by system("$cmd") if a specified timeout
occured.
For example, rsh will time out in 75 seconds if the
remote machine is down. Suppose I want to do
system("rsh $host $cmd");
and if it did not succeed in $timeout seconds, interrupt
the above process and print out "system is down".
In expect one can do "set timeout $timeout". Is there
a simple to do it in perl? I know Comm.pl can mimic
expect but that may be an overkill for the above task.
Thanks for any info.
Helina
------------------------------
Date: 5 Nov 1997 16:17:10 -0800
From: colink@latticesemi.com (Colin Kuskie)
Subject: Re: Perl 5.004_04 is available (Maintenance Release 4 for Perl5.004)
Message-Id: <63r2a6$415@sarek.latticesemi.com>
In article <63d5gd$bv0$1@news1.teleport.com>, Tim Bunce <timbo@ig.co.uk> wrote:
>Patch for compile-time warnings in while loops showing "line 65535":
>Index: op.c
>*************** OP *cont;
>*** 2853,2856 ****
>--- 2853,2857 ----
>
> if (expr) {
>+ copline = whileline;
> scalar(listop);
> op = new_logop(OP_AND, 0, &expr, &listop);
Has anyone tried compiling perl5.004_04 with this patch? I did and
found that it still reports:
Value of <HANDLE> construct can be "0"; test with defined()
at foo line 65535.
instead of the real line number (in this case 3).
After a little digging into op.c, I found that the context in which the
patch is supposed to be applied isn't in there. Sure enough, there is
a line 2853-2856, but the code from the patch doesn't resemble
op.c at all. I couldn't even find lines resembling those anywhere in
op.c (or any of the other files).
Is it possible that the diff was generated from a different op.c,
perhaps the one for the alpha perl5.005?
Colin Kuskie
colink@latticesemi.com
------------------------------
Date: Thu, 06 Nov 1997 02:26:50 GMT
From: m.king.garbage@praxa.garbage.com.au (Mike King)
Subject: Re: Protecting Perl Source
Message-Id: <34612a61.93688887@news.ozemail.com.au>
There is a tool somewhere called perl2exe (shareware), but it is
Wintel only. By turning your scripts into .EXE files, you get a form
of protection (until someone works out how to reverse engineer it).
Mike
------------------------------
Date: Wed, 05 Nov 1997 23:27:51 -0500
From: Alan <ahecker@interport.net>
Subject: Regex question
Message-Id: <34614747.69EA069C@interport.net>
Folks,
Pardon my question (cuz it's pretty simple). I have a small script that
I've done that takes a person's first name, last name & email address
from <STDIN>. It then outputs their email address, followed by first
name & last name. While this is easily done with a split, it was
suggested to me that I try it using regexes. I decided to try it,
figuring it would make me even the slightest bit better at them (cuz I'm
very new to them, as I am to Perl (week 6 folks!)).
Well, to cut to the heart of the matter, I'm worse at them than I
thought. With the regex I'm using, the sample line:
Foo Bar foobar@foobar.com
becomes:
foobar Foo Bar
The regex, as I have it, is as follows:
s/(\w+)\s+(\w+)\s+(\.*)/$3 $1 $2/;
What am I doing wrong?
As always, any & all help is greatly appreciated.
- Alan Hecker
--
"Never send a Monster to do the work of an Evil Scientist."
------------------------------
Date: Wed, 05 Nov 1997 18:05:42 -0600
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: Sorting and Counting with PERL
Message-Id: <346109D6.24BE@us.ibm.com>
app6042 wrote:
>
> I can't fathom a solution for this. I have a list of about 80,000
> timestamps, e.g.,
>
> 03/Jun/1997:13:34:13
> 03/Jun/1997:13:34:13
> 03/Jun/1997:13:36:13
> 03/Jun/1997:13:36:13
> 03/Jun/1997:13:36:13
> 03/Jun/1997:13:36:13
> 03/Jun/1997:13:36:13
> 03/Jun/1997:13:36:13
> 03/Jun/1997:13:36:13
> 03/Jun/1997:13:36:13
> 03/Jun/1997:13:36:13
> 03/Jun/1997:13:36:14
> 03/Jun/1997:13:36:14
> 03/Jun/1997:13:36:14
> 03/Jun/1997:13:36:14
> 03/Jun/1997:14:11:41
> 03/Jun/1997:14:11:41
> 03/Jun/1997:14:11:41
> 03/Jun/1997:14:11:41
> 03/Jun/1997:14:11:41
>
> I need to use PERL to count the number of instances each unique
> timestamp occurs. Can someone please help me on this?
>
> Thanks,
> Mark
Well, I'll bet that there is a one-liner that will do this easily, but
I'll try a little more of an expanded approach. If you want to condense
it down to one line, feel free. (Actually, since I'm also relatively new
to perl, do any of you experts want to show the one-line version?)
The basic idea is to use a hash function where each individual timestamp
will be a separate key. If you don't know what a hash function is, you
should check out "Learning Perl" a.k.a. The Llama Book. It's published
by O'Reilly. Check out "http://www.ora.com/".
I've briefly commented the following code. Hopefully it's enough for
you to follow. I assumed that your data file would contain only
timestamps in the form that you provided above.
-------------------------
#!/usr/bin/perl
# Open the data file. I called it data.txt.
open (IN,"data.txt") or die "Can't open file.";
while ($line = <IN>) { # Read in the data 1 line at a time
chomp($line);
if (exists $counter{$line}) { # Check if we've already seen this one
$counter{$line}++; # If we have, then increment the
counter
}
else {
$counter{$line} = 1; # First time we've seen it. Counter = 1
}
}
# output - You'll probably want to redirect to a file.
foreach $timestamp (sort keys %counter) {
print "Timestamp: $timestamp count: $counter{$timestamp}\n";
}
-------------------------
Using your input, I got the following ouput:
Timestamp: 03/Jun/1997:13:34:13 count: 2
Timestamp: 03/Jun/1997:13:36:13 count: 9
Timestamp: 03/Jun/1997:13:36:14 count: 4
Timestamp: 03/Jun/1997:14:11:41 count: 5
The problem with this code is that it's always going to sort by day
first because that's the way the data is input. In other words, all the
3rd's of every month will be grouped together, etc...
Perhaps it would be better to split the $line as it's input and
rearrange the values so that the sorting would make more sense.
Hopefully, though, this will at least get you pointed in the right
direction.
-----------
James Ludlow (ludlow@us.ibm.com)
This isn't tech support, and all opinions are my own.
------------------------------
Date: Wed, 05 Nov 1997 20:27:04 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Sorting and Counting with PERL
Message-Id: <comdog-ya02408000R0511972027040001@news.panix.com>
In article <346109D6.24BE@us.ibm.com>, James Ludlow <ludlow@us.ibm.com> wrote:
>Well, I'll bet that there is a one-liner that will do this easily, but
>I'll try a little more of an expanded approach. If you want to condense
>it down to one line, feel free. (Actually, since I'm also relatively new
>to perl, do any of you experts want to show the one-line version?)
well, you look like you are doing pretty good so far :)
>while ($line = <IN>) { # Read in the data 1 line at a time
> chomp($line);
> if (exists $counter{$line}) { # Check if we've already seen this one
> $counter{$line}++; # If we have, then increment the
>counter
> }
> else {
> $counter{$line} = 1; # First time we've seen it. Counter = 1
> }
>}
you could do without the check of exists, although i would lexically
scope the hash. when you increment a key that does not have a defined
value, it will be set to one. you could condense it to:
while( chomp($_ = <IN>) ) { $counter{$_}++ }
although this doesn't use a nifty trick that Tad showed earlier (but
not in response to this question). he remembered the order of
timestamps in an array so he didn't have to sort the data (for instance,
if there was data from July and Aug). in that case it's a one line
addition to your example:
if (exists $counter{$line})
{ # Check if we've already seen this one
$counter{$line}++; # If we have, then increment the counter
}
else
{
$counter{$line} = 1; # First time we've seen it. Counter = 1
push @order, $line; # remember the order in which we find them
}
then to print the results
foreach( @order )
{
print "$_\t$counter{$_}\n";
}
which gets around the problem of sort() being very inefficient for
large lists.
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Thu, 6 Nov 1997 02:30:31 GMT
From: bskendig@netcom.com (Brian Kendig)
Subject: Re: Sorting and Counting with PERL
Message-Id: <bskendigEJ7DMv.B5y@netcom.com>
app6042 wrote:
> I can't fathom a solution for this. I have a list of about 80,000
> timestamps, e.g.,
> ...
> I need to use PERL to count the number of instances each unique
> timestamp occurs. Can someone please help me on this?
Easy: ;-)
system "uniq -c mylist.txt > mylist.count";
Assuming you're on a system that has 'uniq', of course. You could use
backquotes or an 'open' statement and read from a pipe executing this
command if you wanted to, also.
No sense reinventing the wheel if you don't need to...
--
_/_/_/ Be insatiably curious. Je ne suis fait comme aucun
/_/_/ Ask "why" a lot. de ceux que j'ai vus; j'ose croire
_/_/ n'etre fait comme aucun de ceux qui existent.
/ Brian Kendig Si je ne vaux pas mieux, au moins je suis autre.
/ bskendig@netcom.com -- Rousseau
http://people.netscape.com/brian/
------------------------------
Date: Thu, 06 Nov 1997 12:21:52 +1100
From: Justin Wills <justin@nectar.com.au>
Subject: Re: unset an array
Message-Id: <34611BAF.D6B91332@nectar.com.au>
--------------38E244435870DEF1C543B6DE
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Ky Nguyen wrote:undef @listname;
> hi all
>
> i have a challenge in my program that i need some helps:
> i need to define # of lists, combine the information fr the list
> and print the report (just like a inner join in RDMS world). i
> then repeat the same process again with the same lists but diff
> source. the problem: the old lists grow and i'd like to reinitialize
> them for each iteration.
>
> i tried unset $VAR but perl didnt detect my intention!!
> i guess i can pop all items in the lists but that's pretty bad method
> i'd say).
> or ... is there a proper way to make your array or your list empty.
>
> thanks in advance.
> --
> ''~``
> ( o o )
> +-.oooO--(_)--Oooo.-----------------------------------+
> | Light travels faster than sound. This is why some |
> | people appear bright until you hear them speak. |
> | .oooO |
> | ( ) Oooo. |
> +----\ (----( )-------------------------------------+
> \_) ) /
> (_/
--
Regards,
Justin Wills
justin@nectar.com.au
--------------38E244435870DEF1C543B6DE
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<HTML>
Ky Nguyen wrote:undef @listname;
<BR>
<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>hi all
<P>i have a challenge in my program that i need some helps:
<BR>i need to define # of lists, combine the information fr the list
<BR>and print the report (just like a inner join in RDMS world). i
<BR>then repeat the same process again with the same lists but diff
<BR>source. the problem: the old lists grow and i'd like to reinitialize
<BR>them for each iteration.
<P>i tried unset $VAR but perl didnt detect my intention!!
<BR>i guess i can pop all items in the lists but that's pretty bad method
<BR>i'd say).
<BR>or ... is there a proper way to make your array or your list empty.
<P>thanks in advance.
<BR>--
<BR> ''~``
<BR> ( o o )
<BR>+-.oooO--(_)--Oooo.-----------------------------------+
<BR>| Light travels faster than sound. This is why some |
<BR>| people appear bright until you hear them speak.
|
<BR>| .oooO
|
<BR>| ( ) Oooo.
|
<BR>+----\ (----( )-------------------------------------+
<BR> \_) ) /
<BR>
(_/</BLOCKQUOTE>
<PRE>--
Regards,
Justin Wills
justin@nectar.com.au</PRE>
</HTML>
--------------38E244435870DEF1C543B6DE--
------------------------------
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 1277
**************************************