User Profile

Collapse

Profile Sidebar

Collapse
Nathan Belomy
Nathan Belomy
Last Activity: Aug 3 '12, 04:57 AM
Joined: Sep 29 '11
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Nathan Belomy
    replied to Sum of Numbers in an Array
    in Perl
    Thank You, I will try one too. So kind of you both to help me. Really appreciate that.
    See more | Go to post

    Leave a comment:


  • Nathan Belomy
    replied to Sum of Numbers in an Array
    in Perl
    Code:
    #!/usr/bin/perl
    
    use strict;
    use warnings;
    
    my @array = (1..1000);
    my $sum = 0;
    
    foreach my $num (@array){
        $sum = $sum + $num;
    }
    
    sub total {
    my($v1) = print $sum;
    }
    
    
    my($output) = &total();
    print "$output\n";
    Happy as a clown. Only thing is, I'm right when I say the foreach is not a subroutine,...
    See more | Go to post

    Leave a comment:


  • Nathan Belomy
    replied to Sum of Numbers in an Array
    in Perl
    That helps a bunch. Man I still got a lot to learn. That little trick
    $1 = $1 + $other didn't know you could do that. Yah man thanks again since I actually got so pissed, I broke something. At least I don't own a gun.
    See more | Go to post

    Leave a comment:


  • Nathan Belomy
    started a topic Sum of Numbers in an Array
    in Perl

    Sum of Numbers in an Array

    Code:
    #!/usr/bin/perl
    
    @array = (1..1000);
    
    sub total {
    my($v1) = print @array;
    } 
    
    my($output) = &total();
    I'll figure it out. Don't need your help. Thanks. Since the array is just

    @array = (1..1000);
    print @array;

    or

    some bs, this thing sucks.
    See more | Go to post
No activity results to display
Show More
Working...