gauravflame
asked on
string operation II
I am using :
@string = ('0x01');
$string[2] = ('0x03');
$string[3] = ('0x04');
local $"=",";
$string_value = "{0x05,0x06,@string}";
print $string_value;
Output :
{0x05,0x060x01,,0x03,0x04} # I am getting 2 single quotes
With Warning :
use of uninitialize value in join or string
@string = ('0x01');
$string[2] = ('0x03');
$string[3] = ('0x04');
local $"=",";
$string_value = "{0x05,0x06,@string}";
print $string_value;
Output :
{0x05,0x060x01,,0x03,0x04}
With Warning :
use of uninitialize value in join or string
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That's right ...
and since it is undefined, trying to use it in join$",@string gives a warning
splain
/usr/bin/splain: Reading from STDIN
Use of uninitialized value in join or string
Use of uninitialized value in join or string (#1)
(W uninitialized) An undefined value was used as if it were already
defined. It was interpreted as a "" or a 0, but maybe it was a mistake.
To suppress this warning assign a defined value to your variables.
To help you figure out what was undefined, perl tells you what operation
you used the undefined value in. Note, however, that perl optimizes your
program and the operation displayed in the warning may not necessarily
appear literally in your program. For example, "that $foo" is
usually optimized into "that " . $foo, and the warning will refer to
the concatenation (.) operator, even though there is no . in your
program.
splain
/usr/bin/splain: Reading from STDIN
Use of uninitialized value in join or string
Use of uninitialized value in join or string (#1)
(W uninitialized) An undefined value was used as if it were already
defined. It was interpreted as a "" or a 0, but maybe it was a mistake.
To suppress this warning assign a defined value to your variables.
To help you figure out what was undefined, perl tells you what operation
you used the undefined value in. Note, however, that perl optimizes your
program and the operation displayed in the warning may not necessarily
appear literally in your program. For example, "that $foo" is
usually optimized into "that " . $foo, and the warning will refer to
the concatenation (.) operator, even though there is no . in your
program.
ASKER