Types of attribute and then describe it.



Types of attribute and then describe it...

Answer / mahesh

use Attribute::Types;

my $count : INTEGER; # Can only store an integer
my $date : INTEGER(1..31); # Can only store an int
between 1..31
my $value : NUMBER; # Can only store a number
my $score : NUMBER(0.1..9.9); # Can only store a num
between 0.1..9.9
my @rain : NUMBER; # Elements can only
store numbers
my %vars : SCALAR; # Entries can only
store scalar refs
my %handler : CODE; # Entries can only
store sub refs
my $arr : ARRAY; # Can only store array ref
my @hashes : HASH; # Elements can only
store hash refs
my $glob : GLOB; # Can only store a
typeglob ref
my $pattern : REGEX; # Can only store a qr'd
regex
my $ref2 : REF; # Can only store a
meta-reference

my $obj : Type(My::Class); # Can only store
objects of (or
# derived from) the
specified class

my $x : Type(/good|bad|ugly/); # Can only store
strings matching
# the specified regex

sub odd { no warnings; $_[0]%2 }

my $guarded : Type(&odd); # Can only store values
for which
# odd($value) returns true

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More General Aptitude Interview Questions

A boy multiplied a number with 10 and got 100,instead of dividing it . If he divided it what would be the answer?

0 Answers   IBM, TATA,


(57*57*57-50*50*50)/(57*57-57*50+50*50)

4 Answers   HCL, TCS,


One of the longest sides of the triangle is 20 m. The other side is 10 m. Area of the triangle is 80 m2. What is the another side of the triangle?

0 Answers   HCL,


If substitution is as it's burnout. Didn't remember. But this is one.

0 Answers   3D PLM,


I want the sbi clerical exam model papers

0 Answers  






mactro in related to

0 Answers  


If A/B = 3/5,then 15A = ?

0 Answers   3i Infotech, Canara Bank, Geodesic, Mu Sigma,


CROSS+ROADS=DANGER.what is the value of D+A+N+G+E+R ?

5 Answers   Infosys,


A=> B means

8 Answers   Geometric Software,


Difference between the perimeters of two concentric circles is 66. Find the difference between radius.

0 Answers   Cisco,


List out the areas in which data structures are applied extensively?

2 Answers   Maveric,


statebankofindia clerk post model question papers 1 copy send my e-mail id alagi_1987@yahoo.co.in

7 Answers   State Bank Of India SBI,


Categories