in reply to Re^4: WHAT IS WRONG TO PASS PARAMETER TO THE ARRAY?
in thread WHAT IS WRONG TO PASS PARAMETER TO THE ARRAY?

should i format it to

The former is not valid Perl - it doesn't compile. The latter is valid Perl. Neither looks like a string. Is the input to your subroutine a string? Does the content of the string look like Data::Dumper output? Or is the input to your subroutine a reference to an array of references to hashes, each with quantity and name keys?

is it a string format?

Since I can't examine the input to your subroutine I can't tell you whether it is a string. You are the only one who has access to your subroutine input to determine what it is. If you want help, you must determine what the input is and post that information. It does no good to ask people who don't know and can't find out except by asking you.

is it ok to pass a string to the sub?

It is OK as long as the string contains the required information and the subroutine is written to process that information appropriately. Otherwise the subroutine will not produce the required output.

  • Comment on Re^5: WHAT IS WRONG TO PASS PARAMETER TO THE ARRAY?