Thread sub blubb ($)??: was bewirkt das $??
(3 answers)
Opened by steinwolf at 2003-09-03 20:14
Einen Skalar als Parameter um genau zu sein.
\$ ist eine Referenz auf ein Skalar, @-List usw... Das ganze hebelt man jedoch aus wenn man die Sub mit dem & aufruft: Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 format_c@linux:/media/sda1/Scripte> perl sub test ($) { my $text = shift; $text ||= ''; print $text,"\n"; } # Test1 test('Hallo'); # Test2 &test(); # Test3 &test('Hallo','Duda'); # Test4 test('Hallo','Duda'); Too many arguments for main::test at - line 13, near "'Duda')" Execution of - aborted due to compilation errors. format_c@linux:/media/sda1/Scripte> Gruß Alex |