when you loop thru keys, is there a way to get the corresponding value?
-Original Message-
From: Thomas Drugeon [mailto:tdrugeon;ina.fr]
Sent: Tuesday, October 29, 2002 10:39 AM
To: [EMAIL PROTECTED]
Subject: Re: Passing multiple hashes into a sub-routine and returning
them
hashes and
foreach $key (keys %hash) {
print key: $key - value: $hash{$key}\n;
}
The code above loops through the keys (in no particular order) and
prints each key along with its value.
-Original Message-
From: Reddy Kankanala [mailto:rkankanala;Interelate.com]
Sent: Tuesday, October
Basically you may use something like this (note that this is old fashioned
perl style - before references were invented)
%a = (ak1 = av1, ak2 = av2);
%b = (bk1 = bv1, bk2 = bv2);
func (*a, *b);
foreach $a (keys %a)
{
print $a = $a{$a}\n;
}
foreach $b (keys %b)
{
print $b =
Thanks Adrian!
-Original Message-
From: Stovall, Adrian M. [mailto:Adrian.Stovall;durez.com]
Sent: Tuesday, October 29, 2002 11:12 AM
To: [EMAIL PROTECTED]
Subject: RE: Passing multiple hashes into a sub-routine and returning
them
foreach $key (keys %hash) {
print key: $key -
As far as I can tell, the return value from LWP::Simple::get is simply a
long string. In my case, I'm grabbing an HTML page that contains a list of
dates that link to maintenance notices for that date specified.
The input would look something like:
a href =
Title: RE: Terrible at my logic
Hi
friends,
I want to generate some 1000 or more passwords for some NT
machine.
I
should be able to generate an 8 digit alphanumeric random numbers from the list
of characters.
Say I
have 3 strings...
First
string : 0 - 9 numbers
Second
string : A - Z
Title: RE: Terrible at my logic
@a =
(0..9,A..Z,a..z);
for($I=0;$I1000;$I++)
{
for($x=0;$x8;$x++) {
$index = rand @a;
print $a[$index];
}
print \n;
}
-Original
Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Krishna, Hari
Sent: Tuesday,
Title: RE: Terrible at my logic
perldoc -f rand
here's an example:
printint rand ;
-Original Message-From: Krishna, Hari
[mailto:[EMAIL PROTECTED]]Sent: Tuesday, October 29, 2002
12:48To: 'FARRINGTON, RYAN';
[EMAIL PROTECTED]Subject: Random
numbers
Hi
Title: RE: Terrible at my logic
To make it even a little more fun you could also vary the length of the
password:
@a = (0..9,A..Z,a..z); # password
charactors
@b = (6..14);
# length of
password
for($I=0;$I1000;$I++) {
for($x=0;$x$b[rand @b];$x++) {
print $a[rand @a];
}
print
Title: RE: Terrible at my logic
OH MY
GOD!!!
That
is soo overwhelming
I
don't have enough thatyou 's to say THANKYOU ALL SO VERY
MUCH
your
humble servant,
Hari.
Title: RE: Terrible at my logic
sub GenRandomPW ($Length)
{
# This subroutine generate a
relatively strong random password of a specified length.
WriteLog($LogFile, Entered
GenRandomPW) if $DEBUG;
my $Length = shift;
my $password;
my @chars = ('A'..'H', 'K', 'M', 'N',
Title: RE: Terrible at my logic
Hi,
Please any one suggest how can I add two tabseparated text
files in to one tabseparated text file.
In the
text file 1 and the text file2 One column is common to both the files. So Is
there any way by comparing the record no (which is present in both the
Title: Message
Personally, I like
to useCrypt::GeneratePassword.
You can create passwords that are longer, yet easierfor users
toremember and less likely to be written on a Post-it on their monitor.
-- Mark
Thomas
[EMAIL PROTECTED] Internet Systems Architect User Technology Associates,
I am attempting to migrate a Perl application I developed on
unix to win32 and I've run into a roadblock. This application executes
perl scripts via a pipe to drive automated regression tests of
hardware/software systems. My problem is that on unix I can use a named pipe to
executed test
Hello David,
hmmm i am wondering if use of Threads module will not do the work for
you...it works same on win and on unix.but i think it will need to
recode your applicationnot sure bout it..
--
Best regards,
Martinmailto:corwin;corwin.sk
Tuesday, October
you can use crypt():
#!/usr/bin/perl -w
use strict;
print generate_password(), \n for 1..1000;
sub generate_password
return(substr(crypt(,join('',(0..9,'A'..'Z','a'..'z')[rand 62,rand
62])), -8 ));
}
if you want to check if the same string is generated, you can write some
control
Title: RE: Terrible at my logic
your
data does not match with the info... =(
-Original Message-From: Mohanty, Debi (MED, TCS)
[mailto:[EMAIL PROTECTED]]Sent: Tuesday, October 29, 2002
12:46 PMTo:
[EMAIL PROTECTED]Subject: merging two
tabseparated text files.
Hi,
Title: RE: Terrible at my logic
easy with hashes.
#untested
my %hash1;
my %hash2;
open(FILE1, $file1) || die "Can't open $file1 :
$!\n";
foreach my $line (FILE1)
{
chomp($line);
my @line = split(/ +/,$line);
my $key = $line[0];
$hash1{$key} = join(" ",@line);
}
close(FILE1);
Title: RE: Terrible at my logic
file 3
is a manual merge file. attached below is the file 2 and file
3.
if we
take a small example then .
All
the files are tabseparated text files.
file1
col1 col2 col3
col4
1text1text2
2text4text5
3text6text7
File2
col1col6col7col8
1text11text12
Sorry --
%hshDateLinks ('10/29/2002' = http://site/date-maint-10292002;)
should be:
$hshDateLinks ('10/29/2002' = http://site/date-maint-10292002;)
but you get the idea.
Here's the code that I've used now; but I'm *sure* that there's a simpler,
more elegant way to do this, right?
I know that perl can parse varibles and return the
results if a string has Scaler varibles within them. I
would like to figure out how to do the same with perl
and user defined functions.
Is there a way to do this within a double quoted
string?
example of what I would like to happen:
print
you cant use functions in double quotes. When you pass a string, you must
quote it, and leading ampersand is optional when you call it with
parenthesis...
print Hello ,caps('shain'), Nice to see you today.\n;
sub caps {return uc shift};
-Original Message-
From: [EMAIL PROTECTED]
22 matches
Mail list logo