Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 05-14-2012
Registered User
 
Join Date: Apr 2012
Posts: 17
Thanks: 0
Thanked 1 Time in 1 Post
Basic Question on perl use POSIX [SOLVED]

Hi guys,

I think this is a basic question. I'm not very familiar with this.

I'm trying to round a number up and round a number down. From what I have read this can be done using POSIX. I have tried to to use this, but i'm getting errors:


Code:
sub findGridBounds($$$%)
{
    use POSIX;
    my ($searchValue, $key, $gridTableKey, %gridTable) = @_;
    
    if (exists $gridTable{ $key })                                
    {
        my $inc = ($gridTable{$gridTableKey}[1] - $gridTable{$gridTableKey}[0]) / 501;
        my $mid = (($searchValue - $gridTable{$gridTableKey}[0]) / $inc) + 1;
        
        
        my $gridUpper = ceil($mid);
        my $gridLower = floor($mid);    
        print "Upper is: $gridUpper Lower is: $gridLower\n";

    }

}

I'm getting the following error:


Code:
Global symbol "$gridUpper" requires explicit package name
Global symbol "$gridLower" requires explicit package name

I'm not sure what i'm doing wrong. I'm thinking it has something to do with use POSIX, but i'm not sure.

Thanks guys!

---------- Post updated at 02:00 PM ---------- Previous update was at 12:10 PM ----------

Sorry for waiting ur time.... I just had a stupid syntax error... I'm just learning Perl. Please forgive me.
The Following User Says Thank You to WongSifu For This Useful Post:
Corona688 (05-14-2012)
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
[Solved] basic script help catalinawinemxr Shell Programming and Scripting 2 10-25-2011 12:08 PM
Perl - Posix macro NDxiak Shell Programming and Scripting 0 10-06-2009 04:58 PM
basic nc question peterworth Shell Programming and Scripting 7 08-15-2008 08:27 AM
Basic MD5 Question t4st33@mac.com Filesystems, Disks and Memory 2 01-16-2008 07:33 AM
basic perl question vivekshankar UNIX for Dummies Questions & Answers 1 05-26-2005 12:13 PM



All times are GMT -4. The time now is 07:32 AM.