On Fri, Jun 20, 2008 at 4:52 PM, Bryan R Harris
[EMAIL PROTECTED] wrote:
Bryan R Harris wrote:
John W. Krahn wrote:
Bryan R Harris wrote:
John W. Krahn wrote:
The left hand side of the assignment determines context so the @l2r{...}
part.
That strikes me as odd... When perl goes to
From: Bryan R Harris [EMAIL PROTECTED]
Bryan R Harris wrote:
John W. Krahn wrote:
Bryan R Harris wrote:
John W. Krahn wrote:
The left hand side of the assignment determines context so the @l2r{...}
part.
That strikes me as odd... When perl goes to populate @l2r{a,b}, it
seems
From:Bryan R Harris [EMAIL PROTECTED]
Jenda wrote:
From: Bryan R Harris [EMAIL PROTECTED]
It makes more sense to me that (FILE,FILE) is kind of the same thing as
saying (@a,@b). In list context @a returns the array as a list, but in
scalar context @a returns the number of elements.
From: Bryan R Harris [EMAIL PROTECTED]
Bryan R Harris wrote:
John W. Krahn wrote:
Bryan R Harris wrote:
John W. Krahn wrote:
The left hand side of the assignment determines context so the @l2r{...}
part.
That strikes me as odd... When perl goes to populate @l2r{a,b},
Bryan R Harris wrote:
John W. Krahn wrote:
Bryan R Harris wrote:
Jenda Krynicky wrote:
Context. The FILEHANDLE returns a single line in scalar context and
a list of all lines in a list context. And there is no such thing as
a two-item-list context.
So in the first case the
Bryan R Harris wrote:
John W. Krahn wrote:
Bryan R Harris wrote:
John W. Krahn wrote:
The left hand side of the assignment determines context so the @l2r{...}
part.
That strikes me as odd... When perl goes to populate @l2r{a,b}, it
seems to me that it would go through this process:
-
Bryan R Harris wrote:
John W. Krahn wrote:
Bryan R Harris wrote:
John W. Krahn wrote:
The left hand side of the assignment determines context so the @l2r{...}
part.
That strikes me as odd... When perl goes to populate @l2r{a,b}, it
seems to me that it would go through this
From: Bryan R Harris [EMAIL PROTECTED]
Given an open filehandle, why don't these two things do the same thing?
**
@l2r{a,b} = (FILE, FILE);
$c = FILE;
**
$l2r{a} = FILE;
$l2r{b} = FILE;
$c = FILE;
Bryan R Harris wrote:
From: Bryan R Harris [EMAIL PROTECTED]
Given an open filehandle, why don't these two things do the same thing?
**
@l2r{a,b} = (FILE, FILE);
$c = FILE;
**
$l2r{a} = FILE;
$l2r{b} = FILE;
$c = FILE;
Bryan R Harris wrote:
From: Bryan R Harris [EMAIL PROTECTED]
Given an open filehandle, why don't these two things do the same thing?
**
@l2r{a,b} = (FILE, FILE);
$c = FILE;
**
$l2r{a} = FILE;
$l2r{b} = FILE;
$c
Bryan R Harris wrote:
John W. Krahn wrote:
Bryan R Harris wrote:
Jenda Krynicky wrote:
Context. The FILEHANDLE returns a single line in scalar context and
a list of all lines in a list context. And there is no such thing as
a two-item-list context.
So in the first case the assignment to
Given an open filehandle, why don't these two things do the same thing?
**
@l2r{a,b} = (FILE, FILE);
$c = FILE;
**
$l2r{a} = FILE;
$l2r{b} = FILE;
$c = FILE;
**
The first seems to be
On Thu, Jun 19, 2008 at 5:50 AM, Bryan R Harris
[EMAIL PROTECTED] wrote:
Given an open filehandle, why don't these two things do the same thing?
**
@l2r{a,b} = (FILE, FILE);
$c = FILE;
because @l2r{...} is a list, right?
so the statement above is in a
From: Bryan R Harris [EMAIL PROTECTED]
Given an open filehandle, why don't these two things do the same thing?
**
@l2r{a,b} = (FILE, FILE);
$c = FILE;
**
$l2r{a} = FILE;
$l2r{b} = FILE;
$c = FILE;
David Gilden wrote:
Good morning,
Hello,
I would like to populate a hash from a csv text file,
Do you really think that you need to?
then test for the existence of a value in the hash.
A value? Or a key?
perldoc -f exists
If not found return an error message and exit.
ithe text
Good morning,
I would like to populate a hash from a csv text file, then test for the
existence of a value in the hash.
If not found return an error message and exit.
ithe text file will have the format of:
# whitelist created 2/18/06 or some other comment on the first line
name1,nick1
---
David Gilden am Samstag, 18. Februar 2006 16.29:
Good morning,
Good evening here ;-)
I would like to populate a hash from a csv text file, then test for the
existence of a value in the hash. If not found return an error message and
exit.
ithe text file will have the format of:
# whitelist
Am Dienstag, 3. Mai 2005 23.42 schrieb [EMAIL PROTECTED]:
John,
I am a lotus user so my top-down reply is default ...sorry.
Don't know Lotus. No possibilities to change defaults there? ;-)
I think all looks good, but I have to ask why are you initializing an array
to hold values of a hash
:37 cc
AM
Subject
Re: populating a hash with % used
Am Montag, 2. Mai 2005 03.49 schrieb [EMAIL PROTECTED]:
John,
the reg exp s -+ ();
^
was changed to
y/sg//;;
y/-//d;
s{\w+} ();
to exclude the spaces and use y... thx
why are thre operators y or tr more efficient since these operators
Am Montag, 2. Mai 2005 09.44 schrieb John Doe:
Am Montag, 2. Mai 2005 03.49 schrieb [EMAIL PROTECTED]:
John,
the reg exp s -+ ();
^
was changed to
y/sg//;;
y/-//d;
s{\w+} ();
to exclude the spaces and use y... thx
why are
[EMAIL PROTECTED] wrote:
John,
the reg exp s -+ ();
^
was changed to
y/sg//;;
y/-//d;
s{\w+} ();
to exclude the spaces and use y... thx
why are thre operators y or tr more efficient since these operators do not
use pattern matching?
Originally I
John Doe wrote:
Am Montag, 2. Mai 2005 03.49 schrieb [EMAIL PROTECTED]:
John,
the reg exp s -+ ();
^
was changed to
y/sg//;;
y/-//d;
s{\w+} ();
to exclude the spaces and use y... thx
why are thre operators y or tr more efficient since these
* If the format of all your data lines is consistent, you could use
split
on \s+ to get the data fields instead of a tr/m cascade.
* Then, if I understand you correctly, you wantto build a hash with %
keys
and F... values. This could be done with code like
push @{$lookup_hash{$pct_value}},
Am Dienstag, 3. Mai 2005 03.30 schrieb [EMAIL PROTECTED]:
* If the format of all your data lines is consistent, you could use
split
on \s+ to get the data fields instead of a tr/m cascade.
* Then, if I understand you correctly, you wantto build a hash with %
keys
and F... values.
I was thinking of using a hash of arrays b/c I want to look-up each array
by a certain string and that string would the % string.
My goal is to populate a hash of some sort with the % string and its
associated F string.
Here is the data file:
1 2005/01/20 15:39 17 2% -il-o-b- sg
[EMAIL PROTECTED] wrote:
I was thinking of using a hash of arrays b/c I want to look-up each array
by a certain string and that string would the % string.
My goal is to populate a hash of some sort with the % string and its
associated F string.
Here is the data file:
1 2005/01/20 15:39 17
Subject
Re: populating a hash with % used
as the key and F string as
thevalue
Hello all,
I'm obviously making a silly mistake here and would appreciate it if
someone can point out my error. I am trying to populate a hash of a
hash in a while() loop. Here is what I have:
my $i = 0;
my %hash = ();
while (EXPR) {
$hash{SOMETHING}{$i} = $something;
Hello all,
I'm obviously making a silly mistake here and would appreciate it if
someone can point out my error. I am trying to populate a hash of a
hash in a while() loop. Here is what I have:
my $i = 0;
my %hash = ();
while (EXPR) {
$hash{SOMETHING}{$i} = $something;
I am not populating from a file, actually. I'm populating from the
output of $sth-fetch from DBI. The $something and $something_else
variables in this case are numbers which have been defined by the output
of that method.
If I do $hash{SOMETHING}{0} = $something;
Then my hash is populated
If I do $hash{SOMETHING}{0} = $something;
Then my hash is populated correctly. I am only not getting
results if I
do $hash{SOMETHING}{$i} = $something. The key here is how I am using
the variable $i in my hash.
I tried this on my machine and it worked fine:
my $i;
for ( 1..5 ) {
11, 2002 4:11 PM
Subject: RE: populating a hash key using a variable
If I do $hash{SOMETHING}{0} = $something;
Then my hash is populated correctly. I am only not getting
results if I
do $hash{SOMETHING}{$i} = $something. The key here is how I am using
the variable $i in my hash
:-}
Cheers,
Rob
- Original Message -
From: Kipp, James [EMAIL PROTECTED]
To: 'Ian Zapczynski' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, December 11, 2002 4:11 PM
Subject: RE: populating a hash key using a variable
If I do $hash{SOMETHING}{0} = $something;
Then my hash
Yes, I know this should be very easy. Yes I've seen the exercise in
Learning Perl. Still I can't get the darned thing to work. Please help me.
I'm trying to do those time honored exercises from the llama book and having
some trouble.
This is the subroutine I'm using:
sub init_words {
while ($filename = *.secret) {
open (WORDSLIST, $filename) || die can't open $filename: $!;
if (-M WORDSLIST 7.0) {
while ($name =
PROTECTED]
Subject: populating a hash from a text file
Yes, I know this should be very easy. Yes I've seen the exercise in
Learning Perl. Still I can't get the darned thing to work. Please help me.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Kenneth == Kenneth Singleton [EMAIL PROTECTED] writes:
Kenneth Yes, I know this should be very easy. Yes I've seen the
Kenneth exercise in Learning Perl. Still I can't get the darned
Kenneth thing to work. Please help me.
What have you tried? Does this example help?
my %lastname;
38 matches
Mail list logo