RE: Retrieving Values from a HOA

2005-09-22 Thread Thomas Bätzler
Hello Dave, here's your bug: > while (($game_id, @teams) = each %fixture) { > print "Game=$game_id Home=$teams[0]\n"; > } I guess you thought that @teams would get an arry of values. Instead, the array is assigned one array reference. To access the array elements from a referenc

RE: Retrieving Values from a HOA

2005-09-22 Thread Timothy Johnson
The values in %fixture are not arrays. They are references to arrays. You have to dereference them. Here are a few ways you could do it: ### while(($game_id,$teamref) = each %fixture){ #calling the array element using the reference print "G

Retrieving Values from a HOA

2005-09-22 Thread Dave Thacker
Hello perlfolk. Goal: Create a hash of arrays where hash key = match number array[0] = home team array[1] = away team and then retrieve the teams by retrieving all the keys while ( @fixture_rec = $sth->fetchrow_array ) { my $game_id = $fixture_rec[0]; p

Re: RE : Is it possible to force a particular order in a hash?

2005-09-22 Thread Wiggins d'Anconia
Jose Nyimi wrote: > >>-Message d'origine- >>De : John W. Krahn [mailto:[EMAIL PROTECTED] >>Envoyé : jeudi 22 septembre 2005 23:26 >>À : Perl Beginners >>Objet : Re: Is it possible to force a particular order in a hash? >> >> >>Dave Adams wrote: >> >>>I have a hash that I need to use later

RE : Is it possible to force a particular order in a hash?

2005-09-22 Thread Jose Nyimi
> -Message d'origine- > De : John W. Krahn [mailto:[EMAIL PROTECTED] > Envoyé : jeudi 22 septembre 2005 23:26 > À : Perl Beginners > Objet : Re: Is it possible to force a particular order in a hash? > > > Dave Adams wrote: > > I have a hash that I need to use later and display some val

Re: Is it possible to force a particular order in a hash?

2005-09-22 Thread John W. Krahn
Dave Adams wrote: > I have a hash that I need to use later and display some values in a > particular order. Perl comes up with its own way of ordering it but I > am wondering if I can instruct perl to have it listed in the way that > I want. You could store the ordered keys in a separate array or

Re: Is it possible to force a particular order in a hash?

2005-09-22 Thread Jeff 'japhy' Pinyan
On Sep 22, Dave Adams said: I have a hash that I need to use later and display some values in a particular order. Perl comes up with its own way of ordering it but I am wondering if I can instruct perl to have it listed in the way that I want. You can use Tie::IxHash (or Tie::IxHash::Easy if

RE: Is it possible to force a particular order in a hash?

2005-09-22 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Waldemar Jankowski wrote: > On Thu, 22 Sep 2005, Dave Adams wrote: > >> I have a hash that I need to use later and display some values in a >> particular order. Perl comes up with its own way of ordering it but >> I am wondering if I can instruct perl to have it listed in the way >> that I want.

Re: Is it possible to force a particular order in a hash?

2005-09-22 Thread Waldemar Jankowski
On Thu, 22 Sep 2005, Dave Adams wrote: > I have a hash that I need to use later and display some values in a > particular order. Perl comes up with its own way of ordering it but I > am wondering if I can instruct perl to have it listed in the way that > I want. > > Here is the code > > > #!/u

Re: trying to run net::ssh::perl have errors

2005-09-22 Thread Wiggins d'Anconia
Please bottom post... Please group reply so others can help and be helped... O'Brien, Bill wrote: > Thanks I think that work but know it appears I lost /bin/sh, error below > any ideas? > > [EMAIL PROTECTED]:~/.cpan/sources/modules/Crypt-RSA-1.56$ which sh > sh: Command not found. > [EMAIL PROTEC

Is it possible to force a particular order in a hash?

2005-09-22 Thread Dave Adams
I have a hash that I need to use later and display some values in a particular order. Perl comes up with its own way of ordering it but I am wondering if I can instruct perl to have it listed in the way that I want. Here is the code #!/usr/bin/perl -w use strict; my $page = { AUTHOR=>"John

Re: Regular expression in varaible

2005-09-22 Thread Jeff 'japhy' Pinyan
On Sep 22, Michael Gale said: Jeff 'japhy' Pinyan wrote: On Sep 22, Michael Gale said: I have the following line of code and I believe it is correct, but it is not doing what I am expecting it to do: Config file [test] value=^OK$i The problem is that '^OK$i' as a string turned into a reg

Re: Regular expression in varaible

2005-09-22 Thread Michael Gale
I was hoping that $ would mean the end of the string and "i" would mean case insensitive :( Michael Jeff 'japhy' Pinyan wrote: On Sep 22, Michael Gale said: I have the following line of code and I believe it is correct, but it is not doing what I am expecting it to do: Config file [tes

Setting encoding for backtick operator

2005-09-22 Thread Tommy Nordgren
Are there any way to set the charcter coding for output from the backtick operator. I failed to split the output of a tool that generates lines (in utf-16) of the following format : "key" = "key" The left instance is an unlocalized string, the write one will ususally be localized. Splitting

Re: Reverse If and Normal Else

2005-09-22 Thread Jeff 'japhy' Pinyan
On Sep 22, John W. Krahn said: The if statement modifier is just another way to write a logical and statement: $ perl -MO=Deparse -e' display_nothing() if $match_type eq q/none/ ' display_nothing() if $match_type eq 'none'; -e syntax OK $ perl -MO=Deparse -e' $match_type eq q/none/ and display_

Re: Reverse If and Normal Else

2005-09-22 Thread John W. Krahn
Frank Geueke, III wrote: > Hi everyone. Hello, > Okay, so maybe this one is a silly question. I have a > fairly large script and I have a bunch of places where > I'm following a reverse if with a normal else and perl > keeps complaining about it. It seems to make sense to > me, but I guess its

Re: Regular expression in varaible

2005-09-22 Thread Jeff 'japhy' Pinyan
On Sep 22, Michael Gale said: I have the following line of code and I believe it is correct, but it is not doing what I am expecting it to do: Config file [test] value=^OK$i The problem is that '^OK$i' as a string turned into a regex is a regex that can never match. The '$' is the end-of-s

Regular expression in varaible

2005-09-22 Thread Michael Gale
Hello, I have the following line of code and I believe it is correct, but it is not doing what I am expecting it to do: Config file [test] value=^OK$i $regex=$Config->get('test.value'); chomp ($regex); $regex=qr/$regex/;

Re: Reverse If and Normal Else

2005-09-22 Thread Wiggins d'Anconia
Frank Geueke, III wrote: > Hi everyone. > Okay, so maybe this one is a silly question. I have a > fairly large script and I have a bunch of places where > I'm following a reverse if with a normal else and perl > keeps complaining about it. It seems to make sense to > me, but I guess its bad synta

Re: Reverse If and Normal Else

2005-09-22 Thread Jeff 'japhy' Pinyan
On Sep 22, Frank Geueke, III said: display_nothing() if ($match_type eq 'none'); else { } Now I like the reverse if because it takes up one line instead of four (I like braces on their own lines - see else). But this error... syntax error at /usr2/login/fjg/hotspot_tracker/search_by_ip_or_mac

Reverse If and Normal Else

2005-09-22 Thread Frank Geueke, III
Hi everyone. Okay, so maybe this one is a silly question. I have a fairly large script and I have a bunch of places where I'm following a reverse if with a normal else and perl keeps complaining about it. It seems to make sense to me, but I guess its bad syntax. Here is one of them: display_not