Go Back   CodingForums.com > :: Server side development > Perl/ CGI

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-13-2009, 08:45 AM   PM User | #1
bazz
Master Coder

 
Join Date: Apr 2003
Location: in my house
Posts: 5,211
Thanks: 39
Thanked 201 Times in 197 Posts
bazz will become famous soon enoughbazz will become famous soon enough
grep causing an error in output - no.. it was my brain

Hi,
Edit:
Oh how I hate the way my brain doesn't get something until after I have posted. I had a 'return later in the script which was (obviously) stopping the loop.


Can't seem to get to the bottom of this.

It seems that the 'grep' is not doing as I thought. It is meant to make sure that the $tariff_id is in the array @tariff_to_use so that the script only uses the correct tariffs.

Code:
print qq( attu=@tariff_to_use <br /> ); # 85 88 ~ correct

  foreach my $tariff_id ( sort keys %tariff_to_terms ) {
    print qq( tariff_id=$tariff_id<br /> ); # outputs 85 88 ~ correct

    if ( grep /$tariff_id/, @tariff_to_use ){

      my $number_of_nights_this_tariff = $nights_per_tariff{$tariff_id}; 
 
      print qq( nontt=$number_of_nights_this_tariff :: tariff_id=$tariff_id <br /> ); # only outputs 85 ~ should also output 88
what am I missing?

bazz
__________________
"The day you stop learning is the day you become obsolete"! - my late Dad.

Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
Useful MySQL resource
Useful MySQL link

Last edited by bazz; 10-13-2009 at 08:51 AM..
bazz is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:54 AM.


Advertisement
Log in to turn off these ads.