Types of attribute and then describe it.

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

All men of this party are republican . mohan is member of this party. mohan is republican is true or false or camn't say?

905


What is the 8th term in the series 1, 4, 9, 18, 35, 68, . . .

1056


If the area of a square increases by 69%, then the side of the square increased by

919


Find odd one cat,dog,rabbit,hamster,elk.

1098


what is the syllabus for group-1 and upsc exam for ias also specify the age limit for both appsc and upsc exams. is there any age relaxation for divorced women.

3275


A son and father goes for boating in river upstream . After rowing for 1 mile son notices the hat of his fathe falling in the river.After 5 min. he tells his father that his hat has fallen. So they turn round and are able to pick the hat at the point from where they began boating after 5min. Tell the speed of river?

976


sir i need rrb secunderabad goods guard previous exam model papers

2212


In a fraction, if 1 is added to both the numerator at the denominator, the fraction becomes 1/2. If numerator subtracted from the denominator, the fraction becomes 3/4. Find the fraction.

916


A 2D array is declared as A[9,7] and each element requires 2 byte.If A[ 1,1 ] is stored in 3000. Find the memory of A[8,5] ?

1229


In the given quadratic equation, mx2+nx+o=0 .If the ratio of the sum of the roots and the product of roots is 2:7, what can be possible values of b and c?

1016


How many 3 digits with 3 Distinct digits are there from 100-1000.

850


A, B, C made trips to PIZZA centre B made 2.4 times more trips then ! , C made 6 more then A Total Min trips are

960


A car travels 12 kms with a 4/5th filled tank.How far will the car travel with 1/3 filled tank?

1241


There are 1000 doors that are of the open-close type. When a person opens the door he closes it and then opens the other. When the first person goes he opens-closes the doors ion the multiples of 1 i.e., he opens and closes all the doors. When the second goes he opens and closes the doors 2, 4 6 8 rely. Similarly when the third one goes he does this for 3 6 9 12 15th doors rely. Find number of doors that are open at last.

1138


The area of the quadrilateral is 36 What is a*b

985