Closed Thread
Results 1 to 3 of 3

Thread: how to use return

  1. #1
    kiddies is offline Programmer
    Join Date
    May 2009
    Posts
    129
    Rep Power
    0

    how to use return

    i always failed use return in perl when i making program.....altought i follow the book to make script.....what happen....

    Code:
    #!/usr/bin/perl -w
    
    print jumlah(2,3),"\n";
    print jumlah(5,4),"\n";
    
    sub jumlah() {
       ($arg_1,$arg_2) = @_;
       return($arg_1+$arg_2);
    
    }

    i use geany for making script...that have an error in return...help for repaire

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    KevinADC is offline Programmer
    Join Date
    Jan 2007
    Posts
    125
    Rep Power
    0

    Re: how to use return

    Code:
    #!/usr/bin/perl
    
    #look these three pragmas up in the perl documentation
    use warnings;
    use diagnostics;
    use strict;
    
    print jumlah(2,3),"\n";
    print jumlah(5,4),"\n";
    
    sub jumlah {
       my ($arg_1,$arg_2) = @_;
       return($arg_1 + $arg_2);
    
    }
    Note I removed the parentheses after the subroutine name. Add them and run the code again and you will get a warning from perl. Warnings are different than errors.

  4. #3
    kiddies is offline Programmer
    Join Date
    May 2009
    Posts
    129
    Rep Power
    0
    ok thanks i will try 1st

    wow nice n success.....

    but i dont understan to using modul.....ive read but i don have an example for that
    Last edited by WingedPanther; 07-02-2009 at 06:48 AM. Reason: Double post

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. JTextField return value
    By thatsme in forum Java Help
    Replies: 3
    Last Post: 02-02-2011, 06:35 AM
  2. return value from a function
    By onus in forum C and C++
    Replies: 3
    Last Post: 11-15-2010, 06:20 PM
  3. Return Array
    By isuru in forum Java Help
    Replies: 5
    Last Post: 08-21-2010, 02:41 PM
  4. Why not more than one return value?
    By mebob in forum C and C++
    Replies: 20
    Last Post: 08-16-2010, 03:41 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts