Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

In 1978, a kg of paper was sold at Rs25/. If the paper rate increases at 1.5% more than the inflation rate which is 6.5% a year, then what will be the cost of a kg of paper after 2 years?

1112


If a man can swim downstream at 6kmph and upstream at 2kmph, his speed in still water is: It takes 30 days to fill a laboratory dish with bacteria. If the size of the bactiria doubles each day, how long did it take for the bactiria to fill one half of dish?

1374


If A is travelling at 72 km per hour on a highway. B is travelling at a speed of 25 meters per second on a highway. What is the difference in their speeds in m/sec.

1090


Y catches 5 times more fishes than X. If total number of fishes caught by X and Y is 48, then number of fishes caught by X?

1258


Six squares of same dimension are kept side by side to make a rectangle with a perimeter of 182 cm. what is the perimeter of each square.

1133


Girish invested a certain amount at the rate of 8% p.a. for 6 year to obtain an amount of Rs. 28046.How much amount did Girish obtain as simple interest?

1481


Length and breadth of a rectangle are in ratio 7:5. If length is reduced by 5 and breadth by 2, area reduces by 65. Find length and breadth.

1546


Alok and Bhanu play the following min-max game. Given the expression N = X - Y – Z where X, Y and Z are variables representing single digits (0 to 9), Alok would like to maximize N while Bhanu would like to minimize it. Towards this end, Alok chooses a single digit number and Bhanu substitutes this for a variable of her choice (X, Y or Z). Alok then chooses the next value and Bhanu, the variable to substitute the value. Finally Alok proposes the value for the remaining variable. Assuming both play to their optimal strategies, the value of N at the end of the game would be • 4 • -18 • 9 • 2

2594


Complete the series:5,6,7,8,10,11,14,__.

1279


An array was given and we were required to write a function : int CalculateThirdHighest(int a[ ]) : which calculates the third highest number in the array. While coding in C remember to calculate the length of array using formulae length of array=sizeof(a)/sizeof(int). Because the number of elements of array were not passed as argument. i want a solution in C/C++ language

2465


two trees are there. one grows at 3/5 of the other. in 4 years, total growth of trees is 8 ft. what growth will smaller tree will have in 2 years.

1246


chief : tribe :: governor :

1171


There are 7 people who take a test among which M is the worst, R is disqualified, P and S obtain same marks, T scores less than S and Q scores less than P, N scores higher than every one.

1120


where is genarak driving aptitude

2095


how 1000000000 can be written as a product of two factors neither of them containing zeros

1130