Closed Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Need a perl study-buddy

  1. #1
    pvpchina is offline Newbie
    Join Date
    Mar 2008
    Posts
    9
    Rep Power
    0

    Red face Need a perl study-buddy

    I got a test next week in perl If someone could help me with a few things later on id appreciate it..

    my msn is : pvpchina@hotmail.com - maybe I can pay you something wont take more than 1 hour i promise! just need sum questions answered

  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: Need a perl study-buddy

    If you have questions you should just post them. If you are, on the other hand, trying to cheat on a test, forget it. As far as contacting you by email and providing personal service, I'll pass.

  4. #3
    Jordan Guest

    Re: Need a perl study-buddy

    I agree with KevinADC. We do not cheat for you at school. If you are required to learn Perl in school then you should actually learn it, it may help you in the future.

  5. #4
    pvpchina is offline Newbie
    Join Date
    Mar 2008
    Posts
    9
    Rep Power
    0

    Re: Need a perl study-buddy

    its not cheating.. just hm extra tutoring to get an in-depth knowledge..anyways ill ask for some specific help later =) at the moment trying to figure out what chop means mhhhhh

  6. #5
    Jordan Guest

    Re: Need a perl study-buddy

    The chop() function removes the last character of any string, regardless of what that character actually is. chop("jordan") would return cause the string to become "jorda" with a return value of "n".

    Using the Perl chop() function

  7. #6
    KevinADC is offline Programmer
    Join Date
    Jan 2007
    Posts
    125
    Rep Power
    0

    Re: Need a perl study-buddy

    look up perls builtin functions on the perldoc website, Perl version 5.10.0 documentation - perldoc.perl.org but as a personal observation, if you need assistance with chop() you're in for a long and hard journey in learning perl. Hopefully you were just joking.

  8. #7
    pvpchina is offline Newbie
    Join Date
    Mar 2008
    Posts
    9
    Rep Power
    0

    Re: Need a perl study-buddy

    cool thanks, got it. so chop is used to remove the last character, and if i have
    a new line, it will remove the new line when i press enter.

    now i need to know difference between

    $a = <STDIN>;

    my $a = <STDIN>;

    =)) which one to use?

  9. #8
    pvpchina is offline Newbie
    Join Date
    Mar 2008
    Posts
    9
    Rep Power
    0

    Re: Need a perl study-buddy

    #!/usr/bin/perl -w
    use strict;
    sub funky();


    funky();
    print(funky()."\n");

    my $random = <STDIN>;

    print(funky().$random);


    sub funky(){

    my $var1 = $_[0] * 30;

    return $var1;
    }




    also need help with this one.. duno why it doesnt work =(

  10. #9
    KevinADC is offline Programmer
    Join Date
    Jan 2007
    Posts
    125
    Rep Power
    0

    Re: Need a perl study-buddy

    Stop doing this:

    sub funky(){

    do not put parenthesis after subroutine names, write it like this:

    sub funky {

    when you put parenthesis you are creating a prototype, there is no reason to do that and it will just complicate matters if you continue to do it.

    Here it is rewritten simpler and passing $random into the function properly:

    Code:
    #!/usr/bin/perl
    use warnings;
    use strict;
    my $random = 5;
    
    print funky($random);
    
    sub funky{
       my $var1 = $_[0] * 30;
       return $var1;
    }
    Last edited by KevinADC; 03-13-2008 at 01:22 AM.

  11. #10
    pvpchina is offline Newbie
    Join Date
    Mar 2008
    Posts
    9
    Rep Power
    0

    Re: Need a perl study-buddy

    thanks, im totally pro at functions now! =) gimi a task involving sub routines and functions.. wanna see if im pro


    Code:
    #!/usr/bin/perl -w
    use warnings;
    use strict;
    sub one;
    sub two;
    
    print ("\nPlease Choose a converter \n \n celcius to farenheit (press 1) \n Farenheit to celcius (press 2) \n");
    my $a = <STDIN>;
    if ($a == 1) {
    print ("You chose option 1. Enter your value below \n\n");
    my $b = <STDIN>;
    print one($b,32,1.8);
    }
    sub one {
    	my $var1 = ($_[0] * $_[2]) +$_[1];
    	return $var1;
    	}
    if ($a == 2) {
    print ("You chose option 2. Enter your value below\n\n");
    my $c = <STDIN>;
    print two($c,32,(5/9));
    }
    sub two {
    	my $var2 = ($_[0] - $_[1]) * $_[2];
    	return $var2;
    	}


    maybe someone see any improvements here? =))))
    Last edited by pvpchina; 03-13-2008 at 10:19 AM.

Closed Thread
Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. C# Buddy
    By smi_lee in forum C# Programming
    Replies: 2
    Last Post: 07-27-2010, 08:28 AM
  2. Any other Novice PHPers? (Buddy System FTW)
    By Maxxamo in forum PHP Development
    Replies: 2
    Last Post: 01-05-2010, 05:42 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