referencie
Honza Pazdziora
adelton na fi.muni.cz
Pátek Leden 7 14:44:39 MET 2005
> moze mi pomoct niekto vysvetlit nasledovne?
>
> obsah test.pl:
>
> #!/usr/bin/perl
>
> sub test(\%)
> {
> my $reff=shift
> }
>
> my %hash=(kluc=>"hodnota");
> test(%hash);
> test(kluc=>1);
>
> $ perl test.pl
> Type of arg 1 to main::test must be hash (not constant item) at test.pl line 11, near "1)"
> Too many arguments for main::test at test.pl line 11, near "1)"
> Execution of test.pl aborted due to compilation errors.
A v cem je problem? Dokumentace v casti perlsub rika, ze
Any backslashed prototype character represents an actual
argument that absolutely must start with that character.
To znamena, ze pokud mate prototyp \%, musite predat promennou typu
hash (tedy %hash), nikoli hash jako hash.
--
------------------------------------------------------------------------
Honza Pazdziora | adelton na fi.muni.cz | http://www.fi.muni.cz/~adelton/
.project: Perl, mod_perl, DBI, Oracle, large Web systems, XML/XSL, ...
Only self-confident people can be simple.
Další informace o konferenci Perl