Arowana
10-31-03, 10:31 AM
Hi all,
I am trying to write a subroutine which is passed an array. It returns nothing. The routine should add 1 to every value of the array. What would this look like? Here's what I have:
#!/usr/bin/perl
use strict
@numbers = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
sub plus_plus {
print ("++$1 '@numbers'");
}
Like, the answer would be 1, 2, 3, 4, 5, 6, 7, 8, 9, 10. Right now, if I run the script, it just returns to the command line.
I'm a total perl newbie (ya can tell ) Can someone help me out with this? I have a real hard time with arrays and subroutines... Thanks!
I am trying to write a subroutine which is passed an array. It returns nothing. The routine should add 1 to every value of the array. What would this look like? Here's what I have:
#!/usr/bin/perl
use strict
@numbers = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
sub plus_plus {
print ("++$1 '@numbers'");
}
Like, the answer would be 1, 2, 3, 4, 5, 6, 7, 8, 9, 10. Right now, if I run the script, it just returns to the command line.
I'm a total perl newbie (ya can tell ) Can someone help me out with this? I have a real hard time with arrays and subroutines... Thanks!