|
| This is my script.
Here I have some years stored in $key.(for example 1996 1997 etc)
Now, there are some companies for which these are the years.
So suppose I take first company as an example, I may get 1996 and 1997
years for it.
If I select second company, it may have 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999 years for it.
I can select range of years from my from and to select scrollbars.
I took it as $fromyear adn $toyear
if company has all the years from this range are present
then I m putting in front of company in a table.
if some years are absent for any specific company
then I m putting blank spaces in front of comapny in a table.
I have written this code:
foreach my $key(reverse sort keys %hash){
$i = $toyear;
while($i>=$fromyear){
if($key == $i){
print "<td>$hash{$key}</td>";
last;
}else{
print "<td> </td>";
}
$i--;
}
}
But I didnt get desired output.
Can u help me out?
|
|