1

Kindly advice I am unable to print value of a ,b &c

my @array = qw($a,$b,$c);
push(@new_array ,@array);

for my $x (@new_array)
{
DEBUG(" DEBUG : $x);
}

It showing me $a,$b,$c instead of there values.

Thanks,

1
  • If you had use warnings in your code, you would have been given a clue to the problem. If you had added use diagnostics you would have got a lot more detail. Commented Jun 18, 2014 at 15:02

1 Answer 1

2

The qw operator creates a list of strings. It quotes words, so it's "qw".

my @array = qw( x y z );

is exactly the same as

my @array = ( 'x', 'y', 'z' );

Your line:

my @array = qw($a,$b,$c);

is saying

my @array = ( '$a,$b,$c' );

What you want is to drop the qw.

my @array = ( $a, $b, $c );
Sign up to request clarification or add additional context in comments.

3 Comments

Roger Boss .. ) You are STAR
I don't know why I am unable to accept your answer .... I mean check correct... Thanks
I think that there's a minimum amount of time that you have to wait before an answer can be accepted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.