Basic Question on perl use POSIX [SOLVED]


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Basic Question on perl use POSIX [SOLVED]
# 1  
Old 05-14-2012
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.
This User Gave Thanks to WongSifu For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Convert posix regex to pcre (perl)

In order to clean file from html tags i used the following sed 's/<*>//g' filename Right now i need to do the same from php script so i have to use pcre. How to convert? (1 Reply)
Discussion started by: urello
1 Replies

2. Shell Programming and Scripting

[Solved] "Which Perl" Usage Question . . .

Greetings! Just a basic syntax question :) Today, I want to launch a perl script from the command line with an explicit path to wherever perl may be installed on any particular system. In my bumblings, I came up with this: which perl | /etc/something.plOf course it doesn't work; but I was... (2 Replies)
Discussion started by: LinQ
2 Replies

3. UNIX for Dummies Questions & Answers

[Solved] Perl Question - split function with csv file

Hi all, I have a csv file that appears as follows: ,2013/03/26,2012/12/26,4,1,"2017/09/26,5.75%","2017/09/26,1,2018/09/26,1,2019/09/26,1,2020/09/26,1,2021/09/26,1",,,2012/12/26,now when i use the split function like this: my @f = split/,/; the split function will split the data that is... (2 Replies)
Discussion started by: WongSifu
2 Replies

4. Shell Programming and Scripting

[Solved] basic script help

I run a command to extract blob file locations in a large log file to another file to remove all the fluff. Example: # tail -50 samtest|grep -i blob|cut -d "'" -f 2 /ASM/archive/20100311/18a7e13f.blob /ASM/archive/20100312/18b5570b.blob # cat outtest.log... (2 Replies)
Discussion started by: catalinawinemxr
2 Replies

5. Shell Programming and Scripting

Perl - Posix macro

Hey Guys, I'm trying to execute this .. chdir "/Volumes/c/d" or die "Wait for ...... then run script $!\n" ; for my $file (<Color.png>) { my ($name,$path,$suffix) = fileparse($file,".png") ; my $datestamp = strftime("_%m_%d",localtime) ; copy... (0 Replies)
Discussion started by: NDxiak
0 Replies

6. Shell Programming and Scripting

basic nc question

i'm doing this in one terminal: nc -lu 7402 and it appears to start listening properly, then in another i do this: echo "hello" | nc -u localhost 7402 and nothing happens on the listening terminal - what am i doing wrong? thanks. (7 Replies)
Discussion started by: peterworth
7 Replies

7. HP-UX

Basic OS question

Could someone tell me the command to find out the OS version which will give 12 character not the 9 characters(which is usually machine id). uname -i gives machine id and uname -a is more comprehensive way to look. Thanks! (4 Replies)
Discussion started by: catwomen
4 Replies

8. UNIX for Dummies Questions & Answers

Really basic question....

Hello all. Let me start off by saying I know a little more then it seems by me asking this question... here goes I have an old 486 box and I want to start messing around with unix. I've been taking classes for 3 or 4 years in c programming in unix, so I am used to the commands and such, but I... (1 Reply)
Discussion started by: robherms
1 Replies

9. UNIX for Dummies Questions & Answers

basic perl question

Hi, I was jus goin through a ebook on perl....it says u get binary installation for both unix and windows.....doesnt perl come already bundeled with unix ?cause i never installed any perl from binary........but i am able to execute perl programs...... Thanks and Regards Vivek.S (1 Reply)
Discussion started by: vivekshankar
1 Replies

10. UNIX for Dummies Questions & Answers

basic question

I have some basic doubts. Can someone clarify in this forum? 1)if then eval ' tset -s -Q -m ':?hp' ' else eval ' tset -s -Q ' what does it exactly mean in .profile? 2) what are 'nobody' and 'noaccess' usernames in /etc/passwd file. ... (3 Replies)
Discussion started by: asutoshch
3 Replies
Login or Register to Ask a Question