Re: A Problem Using Hashes - Thanks

2009-05-03 Thread Thomas H. George
Thanks for three very helpful answers. I see that my original problem was to focus on getting the variables correct and not paying attention to the data I was sending to them. The three answers I received went far beyond correcting that to point out other improvements and important programing

Re: A Problem Using Hashes - Thanks

2009-05-03 Thread Randal L. Schwartz
Thomas == Thomas H George li...@tomgeorge.info writes: Thomas I have learned a lot and really appreciate such quick and instructive Thomas responses. And if you have overall feedback about the book, I'm always curious so I can fold it into the next edition. -- Randal L. Schwartz - Stonehenge

A Problem Using Hashes

2009-05-02 Thread Thomas H. George
I am inching my way through INTERMEDIATE PERL and tried using hashes to solve Chapter 4, Problem 2. I never used hashes before but my attempted solution convinced me of their value as contrasted to the solution with arrays. The Problem: My solution works but with an error I can't eliminate.

Re: A Problem Using Hashes

2009-05-02 Thread jaime sanmartin
Hope this helps you... #!/usr/bin/perl -w # formatted with perltidy use warnings;# I always use this use strict; my %required_list = ( life_jacket = 'preserver', lotion = 'sunscreen', water = 'water_bottle', coat= 'jacket', ); my %captain = ( name

Re: A Problem Using Hashes

2009-05-02 Thread John W. Krahn
Thomas H. George wrote: I am inching my way through INTERMEDIATE PERL and tried using hashes to solve Chapter 4, Problem 2. I never used hashes before but my attempted solution convinced me of their value as contrasted to the solution with arrays. The Problem: My solution works but with an

RE: A Problem Using Hashes

2009-05-02 Thread David Christensen
Thomas H. George wrote: The difficulty is in the next to last line, the 'unless ...' statement which causes warning: Use of uninitialized value in string eq at chap4-take6.pl line 49. Some debugging hints: 1. Set the output autoflush ($|) Perl variable to a true value near the top of your

Re: Problem with Hashes

2007-11-16 Thread Tom Phoenix
On 11/16/07, Travis Hervey [EMAIL PROTECTED] wrote: I have the below code that is reading in a csv file and writing an xml file. The code as is will work fine if I remove the use strict line. ( I would prefer not to do this.) All of us would prefer that you keep 'use strict'! However as

RE: Problem with Hashes

2007-11-16 Thread Travis Hervey
Thanks Tom and the many others that responded. It is much appreciated. Travis Hervey -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tom Phoenix Sent: Friday, November 16, 2007 12:18 PM To: Travis Hervey Cc: beginners@perl.org Subject: Re: Problem

Re: Problem with Hashes

2007-11-16 Thread Paul Lalli
On Nov 16, 10:26 am, [EMAIL PROTECTED] (Travis Hervey) wrote: I have the below code that is reading in a csv file and writing an xml file. The code as is will work fine if I remove the use strict line. ( I would prefer not to do this.) However as it is now with the use strict it gives me a

Problem with Hashes

2007-11-16 Thread Travis Hervey
I have the below code that is reading in a csv file and writing an xml file. The code as is will work fine if I remove the use strict line. ( I would prefer not to do this.) However as it is now with the use strict it gives me a runtime error of: Can't use string () as a HASH ref while strict

Problem with hashes

2002-10-10 Thread Nicole Seitz
Hi there! I'm very new to Perl and just don't understand an error message I got.Hope you can help me. Now, the file I'm working with contains the following data: ;Structural Safety;Elsevier SD;;; ;Structural Safety (95 ... );ZB-HP;Elsevier;nur online (HGF); ;Subsurface sensing technologies and

RE: Problem with hashes

2002-10-10 Thread nkuipers
I think your script is failing at the defined($line = INPUT). So the hash is not getting populated at all. I think this because your call to open didn't include a , as in open FH, your_file or die $!; Try adding that to your open call and see if it makes a difference. = Original

Re: Problem with hashes

2002-10-10 Thread David Garamond
Nicole Seitz wrote: 17 elsif ($line =~/^;([^\(]+)\s?[^\)]+\)\s?;(ZB-HP);Elsevier;/ ){ 18#print $1\t$2\n\n; 19$title = $1; 20$title =~ s/\s$//; 21$titles{$title}= $2; 22} 23} 24 while ( ($key,

Re: Problem with hashes

2002-10-10 Thread Nicole Seitz
On Thursday 10 October 2002 19:32, you wrote: I think your script is failing at the defined($line = INPUT). So the hash is not getting populated at all. I think this because your call to open didn't include a , as in open FH, your_file or die $!; Try adding that to your open call and

Re: Problem with hashes

2002-10-10 Thread John W. Krahn
Nicole Seitz wrote: Hi there! Hello, I'm very new to Perl and just don't understand an error message I got.Hope you can help me. Now, the file I'm working with contains the following data: ;Structural Safety;Elsevier SD;;; ;Structural Safety (95 ... );ZB-HP;Elsevier;nur online

Re: Problem with Hashes ??

2002-08-21 Thread pn
Hi I am having trouble getting the following script to work. This is a script that I have inherited and am hacking to get it work. In this code, the following check is failing: # Enter Foreach Loop foreach $net (keys %nets) { print Inside Foreach Loop\n; print The value of \$net is :

Re: Problem with Hashes

2002-01-22 Thread Jeff Bisbee
Can you include a dump of the Data Structure in quesiton and possibly a bigger snippet of what you're trying to do? Jeff SIDE NOTE... When things get crazy in your data structures its a good idea to take a peak and

Problem with Hashes

2002-01-21 Thread Kennedy, Todd
Hello, I hope someone can help me. I am attempting to modify a perl script that uses hashes and my problem is that I am trying to add hashes values to the array $o_traffic_rec but I can't seem to reference the value of the new hash. The array is defined as $o_traffic_rec{hosts}{$var1} I am