On Mon, Feb 13, 2012 at 11:49 PM, Martin Wildgruber <[email protected]> wrote:
> Hi,
>
> try:
>
> my $results = $_[0] + $_[1];
thanks,
Before I was confused the use of "my"
Best regards,
>
> mit freundlichen Grüßen
> Martin Wildgruber
>
> On 13.02.2012, at 16:43, lina wrote:
>
>> Hi,
>>
>> #!/usr/bin/perl
>>
>> use strict;
>> use warnings;
>>
>> sub add
>> {
>> $results = $_[0] + $_[1];
>> print "The result was: $results\n";
>> }
>>
>> add(1,2)
>>
>> $ ./subroutines_examples.pl
>> Global symbol "$results" requires explicit package name at
>> ./subroutines_examples.pl line 8.
>> Global symbol "$results" requires explicit package name at
>> ./subroutines_examples.pl line 9.
>> Execution of ./subroutines_examples.pl aborted due to compilation errors.
>>
>> How to adjust the strict in this situations, why we use strict?
>>
>> Thanks with best regards,
>>
>> --
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>> http://learn.perl.org/
>>
>>
>
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/