Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: How to merge cells dynamically using some variable as input in excel using perl

by kcott (Chancellor)
on Jun 21, 2018 at 10:33 UTC ( #1217110=note: print w/replies, xml ) Need Help??


in reply to How to merge cells dynamically using some variable as input in excel using perl

G'day Sandeep Kumar,

Welcome to the Monastery.

"I'm very new to perl, ..."

That's quite OK. We all were once. :-)

There's possibly other issues here but, without being able to see any code outside of the while loop you posted, it would be pure guesswork trying to divine them. So, for now, I'm just going to focus on two areas: the variables $a and $b; and, the use of my.

In perlvar, you'll see that $a and $b are special variables. While you are learning Perl, I strongly recommend that you do not use them for anything except their special purpose. That's a standalone issue unrelated to what follows.

From the code you posted, it looks like you haven't really understood my.

You actually have four instances of "my $a ..." throughout your code; each has its own scope; and, mostly, they do nothing useful as they go out of scope before being used in a meaningful way. Your treatment of $b is similar. Try adding print statements throughout your code to see the values of $a and $b: you may be surprised.

I don't know if you thought you needed my as part of the assignment (you don't, by the way); however, I think it's evident that there's a big hole in your understanding here. I suggest you go back to basics and read: "perlintro: Perl introduction for beginners". That may well raise further questions, which is fine: just ask.

— Ken

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1217110]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (1)
As of 2018-07-23 06:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (459 votes). Check out past polls.

    Notices?