[11578] in Perl-Users-Digest
Perl-Users Digest, Issue: 5178 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 19 12:07:33 1999
Date: Fri, 19 Mar 99 09:00:18 -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 Fri, 19 Mar 1999 Volume: 8 Number: 5178
Today's topics:
$query->header problem with cgi module <philb@mainstream.net>
$var$i or what? <tsawyer@telcom.lgb.cal.boeing.com>
Re: $var$i or what? (Andrew Johnson)
Re: $var$i or what? <Tony.Curtis@vcpc.univie.ac.at>
Re: $var$i or what? <udaa460@axolotl.kcl.ac.uk>
Re: $var$i or what? <tsawyer@telcom.lgb.cal.boeing.com>
Re: Algorithm to split words into "encyclopedia labels" <pjl@be-NOSPAM-st.com>
Any idea to generate charts under Linux ? <ywwong_hk@hotmail.com>
Re: Can you store %hashes in a DBM file <jeromeo@atrieva.com>
Re: Crypt problems <gaving@enter.net>
DB Variable <gaving@enter.net>
Re: does perl discourage obfuscated code? (was Re: Perl <jeromeo@atrieva.com>
Re: localtime (I R A Aggie)
Re: more on & in a filename <zzhao@execulink.com>
Need help on a algorithm <frankhale@worldnet.att.net>
Re: Random for Hash (Larry Rosler)
Reading a file into a hash <frankhale@worldnet.att.net>
Re: script to find user's email or name? <ebohlman@netcom.com>
Re: script to find user's email or name? <dturley@pobox.com>
Re: Subset Question (Andrew Johnson)
Re: Subset Question <Allan@due.net>
System call to sort on NT bs5891@my-dejanews.com
Re: System call (Andrew M. Langmead)
Re: Win32 Perl and DOS-style interrupts <ebohlman@netcom.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 19 Mar 1999 11:35:45 -0500
From: Phil Buckley <philb@mainstream.net>
Subject: $query->header problem with cgi module
Message-Id: <36F27CE1.A8374CCC@mainstream.net>
I used the following code to jump from a framed html page to a full
screen html page:
if ($param{'Submit'} eq "Proceed to Checkout") {
&update_cart;
dbmopen (%CART, "/var/tmp/$cookie{$cookie_name}", 0644) || die "cannot
open DBM";
print $query->header(-target=>'_top');
&showform($header);
&showform('checkout1.template');
&showform($footer);
dbmclose (%CART);
}
Works fine with NN4 but keep the frames with IE4, I'm a bit confused....
has anyone run across the same problem and found a fix. I'm stumped, and
just when I thought I was about done, damn!
TIA,
Phil Buckley
------------------------------
Date: Fri, 19 Mar 1999 08:07:31 -0800
From: Tim Sawyer <tsawyer@telcom.lgb.cal.boeing.com>
Subject: $var$i or what?
Message-Id: <36F27643.E169A710@telcom.lgb.cal.boeing.com>
I'm really reluctant to ask this question because it seems like there
must be a simple answer. But I've been struggling with this all week.
I'm studying the O'Reilly Perl books and materials from the last Perl
Conference but I'm still stumped. So here goes...
Given $var1 and $var2 I want to loop, use $i to modify var, and print
the value. Here's one attempt using a reference, but obviously that's
not the right approach. Thanks for helping.
#!/usr/bin/perl
my $var1="this is var 1";
my $var2="this is var 2";
my $value;
for ($i =1 ; $i <= 2 ; $i++) {
$value = "var$i";
print "The value of var$i is ", \$value, "\n";
}
--
Tim
------------------------------
Date: Fri, 19 Mar 1999 16:17:37 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: $var$i or what?
Message-Id: <BMuI2.707$gk3.2133@news1.rdc1.on.wave.home.com>
In article <36F27643.E169A710@telcom.lgb.cal.boeing.com>,
Tim Sawyer <tsawyer@telcom.lgb.cal.boeing.com> wrote:
! I'm really reluctant to ask this question because it seems like there
! must be a simple answer. But I've been struggling with this all week.
! I'm studying the O'Reilly Perl books and materials from the last Perl
! Conference but I'm still stumped. So here goes...
!
! Given $var1 and $var2 I want to loop, use $i to modify var, and print
! the value. Here's one attempt using a reference, but obviously that's
! not the right approach. Thanks for helping.
!
! #!/usr/bin/perl
! my $var1="this is var 1";
! my $var2="this is var 2";
! my $value;
! for ($i =1 ; $i <= 2 ; $i++) {
! $value = "var$i";
! print "The value of var$i is ", \$value, "\n";
! }
you are trying to use symbolic references which are in general
not a good idea, and won't work with my() variables ... and most
problems people turn to symbolic refs for can usually be solved
with a hash:
my %var;
$var{1} = "this is var1";
$var{2} = "this is var2";
foreach my $i (1,2) {
print "The value of var$i is: $var{$i}\n";
}
regards
andrew
------------------------------
Date: 19 Mar 1999 17:18:34 +0100
From: Tony Curtis <Tony.Curtis@vcpc.univie.ac.at>
Subject: Re: $var$i or what?
Message-Id: <83yakt78rp.fsf@vcpc.univie.ac.at>
Re: $var$i or what?, Tim
<tsawyer@telcom.lgb.cal.boeing.com> said:
Tim> I'm really reluctant to ask this question
Tim> because it seems like there must be a simple
Tim> answer. But I've been struggling with this all
Tim> week. I'm studying the O'Reilly Perl books and
Tim> materials from the last Perl Conference but I'm
Tim> still stumped. So here goes...
Tim> Given $var1 and $var2 I want to loop, use $i to
Tim> modify var, and print the value. Here's one
Tim> attempt using a reference, but obviously that's
Tim> not the right approach. Thanks for helping.
Tim> #!/usr/bin/perl my $var1="this is var 1"; my
Tim> $var2="this is var 2"; my $value; for ($i =1 ;
Tim> $i <= 2 ; $i++) { $value = "var$i"; print "The
Tim> value of var$i is ", \$value, "\n"; }
TIMTOWTDI of course:
my $var1 = "this is var 1";
my $var2 = "this is var 2";
my $value;
foreach my $i ( 1 .. 2 ) {
eval "\$value = \$var$i";
print "The value of var$i is ", $value, "\n";
}
However, this problem might be better solved through
use of an array @var or via a hash %var.
hth
tony
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien. | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds! | private email:
Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>
------------------------------
Date: 19 Mar 1999 16:16:10 GMT
From: Allan Hawdon <udaa460@axolotl.kcl.ac.uk>
Subject: Re: $var$i or what?
Message-Id: <7ctt8a$alj$1@willow.cc.kcl.ac.uk>
Why don't you just use an array? Is there some reason why you need to
do it the way shown?
Tim Sawyer <tsawyer@telcom.lgb.cal.boeing.com> wrote:
: I'm really reluctant to ask this question because it seems like there
: must be a simple answer. But I've been struggling with this all week.
: I'm studying the O'Reilly Perl books and materials from the last Perl
: Conference but I'm still stumped. So here goes...
: Given $var1 and $var2 I want to loop, use $i to modify var, and print
: the value. Here's one attempt using a reference, but obviously that's
: not the right approach. Thanks for helping.
: #!/usr/bin/perl
: my $var1="this is var 1";
: my $var2="this is var 2";
: my $value;
: for ($i =1 ; $i <= 2 ; $i++) {
: $value = "var$i";
: print "The value of var$i is ", \$value, "\n";
: }
: --
: Tim
------------------------------
Date: Fri, 19 Mar 1999 08:55:14 -0800
From: Tim Sawyer <tsawyer@telcom.lgb.cal.boeing.com>
Subject: Re: $var$i or what?
Message-Id: <36F28171.5AA67177@telcom.lgb.cal.boeing.com>
Thanks Tony,
That worked. I would rather have used an array or hash and tried that at first but
I ran into another problem. You see $var1 and $var2 are actually created from a cgi
program. They are values from a bunch of checkboxes that are generated on the
fly... the user gets to add or remove how many checkboxes are on the form. I
couldn't figure out how to get CGI.pm to keep the state of the form checkboxes
because unchecked boxes have no value. So if the user check boxes 1 and 5, when the
form reloaded checkboxes 1 and 2 would be checked.
Perhaps this really was a CGI.pm question but you know how this group flames those
questions. Thanks again for you answer.
Tony Curtis wrote... in part:
> eval "\$value = \$var$i";
> print "The value of var$i is ", $value, "\n";
>
> However, this problem might be better solved through
> use of an array @var or via a hash %var.
>
Tim
------------------------------
Date: 19 Mar 1999 08:46:29 -0800
From: "Paul J. Lucas" <pjl@be-NOSPAM-st.com>
Subject: Re: Algorithm to split words into "encyclopedia labels"
Message-Id: <pjl.921861793@shell3.ba.best.com>
In <QVnI2.170$rP1.6471@ptah.visi.com> sgrantz@visi.com (Steve Grantz) writes:
>Paul J. Lucas (pjl@be-NOSPAM-st.com) wrote:
>: Given an array of words, I would like to split them into chunks
>: of size N similarly to the way encyclopedias are split up, i.e.,
>[snip]
>: that is: each volume (chunk) is roughly the same size (N);
>[snip]
>: Is there an elegant way to do this without lots of looping and
>: checking words character by character?
>Sorry, Paul, but you have stumbled upon the bin stuffing problem, which
>is hard to solve. (NP-hard to be technical about it).
Now that you mention it, yes it is!
OK, how about s simpler problem: what's an easy way in Perl to
tell how much of two strings match?
$a = 'Hello';
$b = 'Helicopter';
$c = f( $a, $b );
where $c is 'Hel' without doing a lot of looling of checking
character by character?
>: E-mail replies preferred.
>: it's a problem for my
>: real day job.
>OK, but I'm still not going to e-mail the response.
And why not?
- Paul
------------------------------
Date: Sat, 20 Mar 1999 00:25:24 +0800
From: "Y W Wong" <ywwong_hk@hotmail.com>
Subject: Any idea to generate charts under Linux ?
Message-Id: <7cttcs$bjh$1@imsp009a.netvigator.com>
I am writing a perl script to generate HTML file hourly and upload to a web
server.
It use Expect to telnet to a host to collect real time data every 15
minutes.
The perl script used to generate HTML file based on the captured data.
Now, I would like to generate some simple bar charts ( Prefered in jpeg
format )
based on the captured data.
Any idea about what tools or language should be used ?
Regards,
Y W Wong
------------------------------
Date: Fri, 19 Mar 1999 08:27:46 -0800
From: Jerome O'Neil <jeromeo@atrieva.com>
To: Robert Alatalo <mirror@ziplink.net>
Subject: Re: Can you store %hashes in a DBM file
Message-Id: <36F27B02.DD346780@atrieva.com>
Robert Alatalo wrote:
> What I wonder is if anyone knows a way to store the contents
> of the inner hash in the DBM file, so when the program stops and restarts
> I can query the inner hashes for values stored in it.
Install MLDBM.pm, available at a local CPAN near you. It will allow you
to tie complex data structures to a DBM file.
Good Luck!
--
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947
The Atrieva Service: Safe and Easy Online Backup http://www.atrieva.com
------------------------------
Date: Fri, 19 Mar 1999 11:37:55 -0500
From: "Gavin" <gaving@enter.net>
Subject: Re: Crypt problems
Message-Id: <36f27c9a@news3.enter.net>
Dave,
Apache uses a random string, however it does not need to. Below is a
sample progam that will make passwords for apache
$cpass is the encpted password, and $rpass is the input password
$salt = "KE";
$rpass = "Password";
$cpass = crypt($rpass, $salt);
<dccobb@yahoo.com> wrote in message news:7ct6ba$ge6$1@nnrp1.dejanews.com...
> Problem: I have installed an apache server on top of an existing apache
> server, however as I am not root user I cannot use the htpasswd program to
> create passwords for users.
>
> Am I right in saying that Apache uses "Cd" as its encrytion key (salt) or
does
> it use a random key?
>
> As I cannot use htpasswd I have created a Perl program which uses crypt()
> will this do the same job as htpasswd?
>
> Any help is much appreciated, Dave
>
> "Everything should be as simple as possible, but no simpler",
> Albert Einstein.
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 19 Mar 1999 11:23:49 -0500
From: "Gavin" <gaving@enter.net>
Subject: DB Variable
Message-Id: <36f2794d@news3.enter.net>
I am currently trying to store a graphic image into a DB File which is using
the MLDBM module. The program is storing it properly, but when I try and
stream it to a web browser it appears the browser does not see the end of
the file. I have already taken the value of $db{temp} and saved it to a
file. It is storing the image perfectly into the DB. It just wont send it
to the web browser. If I cat the file and send that variable out it works.
I am wondering if there is some kind of buffering issue or something to that
effect. Any help would be appreciated. Please email me back
Program:
#!/usr/bin/perl5
$| = 1;
use DB_File;
use MLDBM qw (DB_File);
use Fcntl;
$dbfile = 'ads.db';
&opendb;
print "Content-Length: 15680\n";
print "Content-type: image/gif\n\n";
print $db{temp};
print "Connection: close\n";
## If I use this code it works properly
#
# $temp = `cat imagename`;
# print "Content-Length: 15680\n";
# print "Content-type: image/gif\n\n";
# print $temp;
# print "Connection: close\n";
&closedb;
sub opendb {
tie (%db, 'MLDBM', $dbfile, O_CREAT|O_RDWR, 0666 || die $!);
}
sub closedb {
untie %db;
}
------------------------------
Date: Fri, 19 Mar 1999 08:19:45 -0800
From: Jerome O'Neil <jeromeo@atrieva.com>
Subject: Re: does perl discourage obfuscated code? (was Re: Perl evangelism)
Message-Id: <36F27921.41890BFC@atrieva.com>
Larry Rosler wrote:
>
> In article <36ED60B9.C9783667@atrieva.com> on Mon, 15 Mar 1999 11:34:17
> -0800, Jerome O'Neil <jeromeo@atrieva.com> says...
> > Russell Schulz wrote:
> ...
> > You will hear no arguments from me that regular expressions are not
> > obfuscatable, or obfuscated.
> >
> > $_'s behavior is well documented, and easily understood. You're asking
> > the "Why don't the French understand Russian?" question.
>
> Your statement above -- that obfuscation is a regex problem -- is
> exactly the same as what you dismiss here as the "Why don't the French
> understand Russian?" question.
Yes, you are correct. Regular expressions are perfectly readable to
those that know them. The point I was driving is that many people
often look at a regular expression and say "That's perl," which is
incorrect and unfair. While regexes have a well documented behavior,
they do lack the "natural language" feel of perl. I think that one who
does not know perl or regexs will have a better chance of figuring out
what a given piece of perl code does than a given regex.
I will say that if they ever come up with a "natural language" regex
engine, I'll beat a path to their door!
--
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947
The Atrieva Service: Safe and Easy Online Backup http://www.atrieva.com
------------------------------
Date: 19 Mar 1999 16:19:04 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: localtime
Message-Id: <slrn7f4upo.ipb.fl_aggie@stat.fsu.edu>
On Mon, 15 Mar 1999 12:25:01 -0800, Larry Rosler <lr@hpl.hp.com> wrote:
+ Which manual did you have in mind? Certainly not the Perl manual. This
+ is all that `perldoc -f localtime` has to say on the matter:
[a somewhat sketchy description of localtime()]
+ # 0 1 2 3 4 5 6 7 8
+ ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
+ localtime(time);
Ummm...maybe its just me, but I grok $isdst as "Is DST?" and therefore
should be treated as a boolean. Obviously, the -1 value would have been
a surprise.
+ Must every Perl programmer know what a 'struct tm' is, or that this
+ refers to a C header <time.h>?
We've had this discussion before. No, they don't have to, but this
is a call to the underlying C-libs, ergo 'man localtime' would have
shed additional light upon the subject. And answered the question.
And before you object to my referencing 'man localtime', many of those
man pages are available via the web...perhaps you should consider
submitting a perlbug report?
Perhaps I will.
James
------------------------------
Date: Fri, 19 Mar 1999 11:11:19 -0500
From: "Jerry Zhao" <zzhao@execulink.com>
Subject: Re: more on & in a filename
Message-Id: <7ctt66$rba$1@nntp2.uunet.ca>
----- Original Message -----
From: Jerry Zhao <zzhao@execulink.com>
Newsgroups: comp.lang.perl.misc
Sent: Thursday, March 18, 1999 11:02 PM
Subject: more on & in a filename
>I encountered the problem in two occasions so far. One is that I have a
>directory whose name has the character '&' in it, and I want to use Perl to
>create a file of the same name that lists its contents.
There is no problem creating a file with '&' in its name. I don't know what
I did wrong before, but I ran the same code again, and it worked.
The second one is still unsolved. I tried to use ' " ' , but it did not
work. The puzzle is that all files were loaded successfully except those
with '&' in their directory names and filenames.
>The other is that I
>have a Perl program that call an external image viewer to load jpg files.
>When I try to load files whose name contain '&', the image viewer gives
>error messages. For example, if the file name passed to the sub is
>"dirname/B&W01.jpg", the error message reads like this: ...dirname/.jpg not
>found...
>
>The following are excerpts from the second case:
>. . .
>push @hits, "$csv\/$name";
>}
>. . .
>
>#load scans by its index (number)
>$load->configure(-command => sub{&loadscan(\$hits[$scan->get-1])})
>}
>
>sub loadscan {
>
>use Win32;
>use Win32::Process;
>
>Win32::Process::Create(my $newPro,
>"C:\\program files\\irview\\i_view32.exe",
>"i_view32 c:\\${$_[0]}",
>0,
>DETACHED_PROCESS,
>
>
>
>
>
------------------------------
Date: Fri, 19 Mar 1999 11:56:30 -0500
From: Frank Hale <frankhale@worldnet.att.net>
Subject: Need help on a algorithm
Message-Id: <36F281BE.CB0AEF4@worldnet.att.net>
Okay I have a problem. I have a file which has records consisting of 5
fields like so
i:1
n:John Smith
e:me@somewhere.com
d:19 Mar 1999
s:some text here
Okay there are multiple records. I have a hash which I store the index
of the records to be deleted. I need to rewrite the file with only the
records I want to keep.
I can't figure out the algorithm to do this.
**Okay here is a summary of my problem**
I got a file with multiple records having 5 fields each
I have a hash I store the indexes that need to be deleted which looks
like so
Say I had 5 messages
1=1
2=1
3=0
4=0
5=0
This means records 1 and 2 need to be deleted and I need to rewrite the
file so that 3,4,5 are the only records there.
Could someone offer a psuedo-code algorithm on how to do this? I would
greatly appreciate it.
The problem I keep having with my existing code is that I use some loops
to get the lines from the existing file and I also loop through my hash
with the delete indexes. What keeps happening is that I keep writing the
file over and over again for each iteration of the loops this causes it
to rewrite the entire file multiple times. To illustrate the problem it
would do this for the above example
2
3 <- First Iteration with out the 1st record
4
5
1
3 <- Second Iteration without the 2nd record
4
5
etc..... Until it finishes with all the iterations of the loop.
So the end result is a file much much larger than I started with and
completely useless.
Okay here is the code I have so far I shortened it up a bit to
illustrate my problem. I am way out in left field and can't seem to
understand the way I need to write this algorithm
# Iterate through each element in the DELETE_INDEX hash.
foreach $DI (keys %DELETE_INDEX)
{
# If the element's data equals 1 then we need to delete this
record.
if ($userdata{$DELETE_INDEX{$DI}} == 1)
{
# For each line in the file do something with that data.
foreach $line (@headers)
{
# If the line equals i: then we have the index
if (substr($line,0,2) eq "i:") {
# store this records index in $index
$index = substr($line,2);
# If this is true we keep the record.
if (not $index == $DI) {
print "<br>index =
".$index."<br>";
}
}
}
}
}
Sample output on 4 records goes like this. If I delete records 1 and 2 I
get the following output
index = 2
index = 3
index = 4
index = 1
index = 3
index = 4
This describes how my algorithm writes to the file multiple times but it
did delete the records I wanted but it did it over multiple iterations
continuing to write back to the file screwing it up.
As you can see I am pretty lost on this. If someone could offer any
psuedo-code for the type of algorithm I need I would really appreciate
it. Thanks.
--
From: Frank Hale
Email: frankhale@worldnet.att.net
ICQ: 7205161
Website: http://www.franksstuff.com
------------------------------
Date: Tue, 16 Mar 1999 13:59:52 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Random for Hash
Message-Id: <MPG.11587438f92b1d42989766@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <7cmgqj$thm$1@camel21.mindspring.com> on Tue, 16 Mar 1999
16:00:57 -0500, Allan M. Due <Allan@due.net> says...
...
> my $ran_value = $Datas{(keys %Datas)[rand keys %Datas]};
Bravo, Allan! I knew I wanted a one-liner, and forgot about 'scalar
keys %hash'. And yours is faster, too. Apparently indexing into a list
is more efficient than storing the list in an array and indexing into
the array.
#!/usr/local/bin/perl -w
use Benchmark;
my %data = (0 .. 999);
timethese(1 << (shift || 0), {
AMD => sub { my $rand = $data{(keys %data)[rand keys %data]} },
LR => sub { my @keys = keys %data;
my $rand = $data{$keys[rand @keys]} },
});
__END__
Benchmark: timing 4096 iterations of AMD, LR...
AMD: 10 wallclock secs (10.11 usr + 0.00 sys = 10.11 CPU)
LR: 14 wallclock secs (14.06 usr + 0.00 sys = 14.06 CPU)
--
Larry Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 19 Mar 1999 11:53:03 -0500
From: Frank Hale <frankhale@worldnet.att.net>
Subject: Reading a file into a hash
Message-Id: <36F280EF.348F738@worldnet.att.net>
Is there a way to read a file into a hash which the fields extend over
multiple lines?
I can do it but I have to strip off newline characters and this f's up
the formatting of the data.
Here is the code I have so far but it will only read fields if they
don't have newline characters in them. In other words it will mess up as
soon as it hits a newline character messing the data up in each field.
#!/usr/bin/perl
@fieldList = qw(Index Message);
open(FILE, "<data.dat");
foreach $line (<FILE>) {
@data{@fieldList} = split(/##/, $line, scalar @fieldList);
foreach (@fieldList) {
printf("%10.10s = %s", $_, $data{$_});
}
}
close(FILE);
--
From: Frank Hale
Email: frankhale@worldnet.att.net
ICQ: 7205161
Website: http://www.franksstuff.com
------------------------------
Date: Fri, 19 Mar 1999 16:29:31 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: script to find user's email or name?
Message-Id: <ebohlmanF8uoH7.M9B@netcom.com>
Bahram Pourghadiri <bahram@onpulse.com> wrote:
: Does anyone know of a script for secretly finding out a user's name or
: email address (for example when they click on a link) or basically as much
: info as possible.
The information simply isn't available. It's not transmitted in an HTTP
request. Period.
------------------------------
Date: Fri, 19 Mar 1999 16:23:05 GMT
From: David Turley <dturley@pobox.com>
Subject: Re: script to find user's email or name?
Message-Id: <7cttks$40q$1@nnrp1.dejanews.com>
In article <01be724f$e55e54e0$0101020a@bahram>,
"Bahram Pourghadiri" <bahram@onpulse.com> wrote:
> Does anyone know of a script for secretly finding out a user's name or
> email address (
hire a PI
--
David Turley
dturley@pobox.com
http://www.binary.net/dturley
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 19 Mar 1999 16:06:23 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: Subset Question
Message-Id: <3CuI2.691$gk3.2104@news1.rdc1.on.wave.home.com>
In article <7ctpag$gu4$1@gaia.ns.utk.edu>,
Robert Gwynne <gwynne@utkux.utk.edu> wrote:
! I'm trying to write an algorithm that gives me all combinations of an array
! such that if @array = (a b c d), it produces:
! ab ac ad bc bd cd
! or
! aa ab ac ad bb bc bd cc cd
!
one way:
my @array = qw(a b c d);
for(my $i = 0; $i < $#array; $i++){
print map{"$array[$i]$array[$_]\n"} $i+1 .. $#array;
}
regards
andrew
------------------------------
Date: Fri, 19 Mar 1999 11:17:07 -0500
From: "Allan M. Due" <Allan@due.net>
Subject: Re: Subset Question
Message-Id: <7ctst4$t2b$1@camel18.mindspring.com>
Robert Gwynne wrote in message <7ctpag$gu4$1@gaia.ns.utk.edu>...
:I'm trying to write an algorithm that gives me all combinations of an array
:such that if @array = (a b c d), it produces:
:ab ac ad bc bd cd
: or
: aa ab ac ad bb bc bd cc cd
:I've tried variations on the example program below to no avail. It seems
:that I should be able to delete the first item of the array each time
:through the loop and end up with all the combinations. However, if I
comment
:out the penultimate line "shift(@array);", I get all of the combinations.
:For example:
:aa ab ac ad ba bb bc bd ca cb cc cd da db dc dd
:They are there, but there's too much redundancy for what I want.
:
:It looks like a problem for CS101, but I'm at a loss to figure out what the
:problem is.
:#!/usr/local/bin/perl -w
:@array = qw(a b c d);
:foreach $item(@array){
: foreach $element(@array){
: print "$item times $element\n";
:}
: shift(@array);
:}
Probably a bad idea to mess with the array you are looping over.
How about?
#!/usr/local/bin/perl -w
use strict;
my @array = qw(a b c d);
my $i = 0;
my $j = 0;
foreach (@array){
foreach ($j..$#array){
print "$array[$i] times $array[$j]\n";
$j++;
}
$j=++$i;
}
HTH
AmD
--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
When you come to a fork in the road take it.
- Yogi Berra
------------------------------
Date: Fri, 19 Mar 1999 16:44:06 GMT
From: bs5891@my-dejanews.com
Subject: System call to sort on NT
Message-Id: <7ctusg$5h0$1@nnrp1.dejanews.com>
ENV: NT, Active State Perl 5.005_03, MKS Toolkit 6.1
File Info: file.dat 700k, delimited data for db. loads
I am writing a script to sort data prior to loading it into a db. Because of
the file size(s) I am using a system call to MKS sort to perform the sort
since I am on NT and do not have a lot of memory to use.
I am running into problems calling the sort. When exec on cmd line the sort
works.
Because the number of key values vary between files I build the cmd line and
pass it to a sub for the sort.
cmd_line example:
cat d:\temp\file.dat |sort -t \~ -k 1 -k 2 > d:\temp\new_file.dat
##
## SORT DATA
##
sub sortData {
chomp($DATAFILE);
!system ("$cmd_line > $OUTPUT_DIR\\$DATAFILE")
or die "Could NOT sort $DATAFILE ($!_)";
} I originally thought it could not find sort so I included the path. That
did not help. Is there a problem using the combination of cat and | and sort?
Is there a better way? Any help would be appreciated. Please cc me on reply
if possible -> bart.smith@db.com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 19 Mar 1999 15:56:24 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: System call
Message-Id: <F8uMy0.8Kp@world.std.com>
theo5@my-dejanews.com writes:
>I hope someone can help. I'm fairly new at this, been writing perl programs
>for about 9 months. Perl is great EXCEPT when I make a system call using
>system. I find that it gives really anomalous results. For example, when a
>call works from the command line, the exact same call will not work using the
>system function from a perl script. Does anyone know what is going on?
First, a terminology correction. Executing the "system()" function is
not a "system call". The term "system call" refers to a program
requesting of the kernel certain low level operations. For example, in
perl, sysopen, sysread, syswrite, close, fork, and exec, pretty much
just call their corresponding system call. A call to the "system"
function is a higher level operation.
Are you running the perl script from the command line? Or having some
other program (like an HTTP server) run it on your behalf? If it is
being run from an HTTP server, you may run into the problem that the
PATH environment variable that your login shell sets up may be
different from the web server's PATH.) If it is being run from an HTTP
server, are the commands that you are trying to run have permissions
that allow the user that runs the HTTP server to execute them?
Are any of these commands that you are trying to run shell
aliases. (Perl eithers invokes the command directly without invoking a
subshell, so it won't see the aliases, or if necessary invokes
/bin/sh, which doesn't know about them.)
Can you write a small script that shows what is going wrong and post
it? For example, this script works on my machine from the shell
prompt:
#!/usr/bin/perl -w
system 'echo hello';
and it produces the following output:
hello
--
Andrew Langmead
------------------------------
Date: Fri, 19 Mar 1999 16:17:54 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Win32 Perl and DOS-style interrupts
Message-Id: <ebohlmanF8unxu.LDH@netcom.com>
Bbirthisel <bbirthisel@aol.com> wrote:
: >proprietary ERP
: >system we use that is Win32-based using Perl and Perl/Tk.
: With this interface, it is DOS-based. You are merely running
: it on Win32.
Nope. It's a Win32 console application, which runs in a flat 32-bit
address space just like a 32-bit graphical application. It won't have
direct access to things like interrupt vectors.
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 5178
**************************************