Perl script to find last column

Dear all,

I am new bee in perl scripting,i have generated one report in which i want to paste some data/text at the end,plz help me

format is like this

$worksheet1->write( 'A5',[\@data1],$format2);

i want to paste my text after this column A50 in column A51 but this column is variable it may change

$worksheet1->merge_range('A51:G51',"New data to be pasted here",$format10);

so how to find out and implement this last column number and where the new data is to be pasted ( just next cell )

The range for merge_range() does not have to be hard-coded.
If you can derive the value 51 from your data, then you can create the first argument of merge_range() dynamically and pass that to the method.

$range = "A".$last_col.":G".$last_col;  # $last_col = 51
$worksheet1->merge_range($range, "New data to be pasted here", $format10);