Perl Home
PERL Functions
© 2011 TutorialsPoint.COM
|
PERL scalar Function
Syntax
Definition and Usage
Forces the evaluation of EXPR to be in scalar context, even if it would normally work in list context.
Return Value
Example
#!/usr/bin/perl -w
@a = (1,2,3,4);
@b = (10,20,30,40);
@c = ( @a, @b );
print "1 - Final Arrary is @c\n";
@c = ( scalar(@a), scalar(@b) );
print "2 - Final Arrary is @c\n";
|
It will produce following results:
1 - Final Arrary is 1 2 3 4 10 20 30 40
2 - Final Arrary is 4 4
| |
|

|
|
|