Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: problem unless I use ".="

by chargrill (Parson)
on May 13, 2007 at 14:30 UTC ( #615170=note: print w/replies, xml ) Need Help??

in reply to problem unless I use ".="

Pretty sure you'll get the warning regardless if you use $a = $a . $b vs. $a .= $b, especially given the above code.*

In your above code, $baseball{yankees} hasn't been initialized, hence the warning that you're trying to use an uninitialized value in a concatenation.

You can get more detail if you use diagnostics; at the top of your program, which yeilds:

Use of uninitialized value in concatenation (.) or string at -e line 1 (#2) (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.

What are you trying to do, exactly?

If you just want to add a new key/value pair to your hash,

$baseball{yankees} = 'new york'; # OR $baseball{yankees} = $baseball{mets};

... will suffice.

* Update: Incorrect

s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; = qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://615170]
[atcroft]: Lady_Aleena: So you are shoving the disparate data into a structure and returning the structure, so you can run it through a (probably simpler) routine that displays only?
[Lady_Aleena]: atcroft, that is the goal.
[Lady_Aleena]: atcroft, this is the last of the printing modules I am going to make stop printing, I think.
[Lady_Aleena]: It will leave me with 8 out of 138 modules that print something.

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2017-05-29 02:37 GMT
Find Nodes?
    Voting Booth?