You are doing perl without strictures enabled. This is a very very bad idea. The code samples you have provided would not even compile under strictures, and furthermore had you been using strictures the proper use of the concatenation operator '.' would have been clear.
Please make sure that every script that you write starts with
use strict;
use warnings;
or if you are on a pre 5.6 version of perl (you may need to alter the path after the #! mark as required by your local setup)
#!perl -w
use strict;
You will find that you learn much faster when the compiler is constantly pointing out ambiguous structures, errors, and other forms of strangeness.
Incidentally if you wish to append chars to a string contained within a scalar the normal approach is
$foo.='some string';
Just about anytime you have a construct that goes like
$foo=$foo (operator) (value)
you can rewrite it as
$foo (operator)= (value)
Note that there is NO space in between the operator and the equals. Common examples of this are
$foo+=10;
$foo*=2;
$foo.='bar';
$foo||='default';
HTH
--- demerphq
my friends call me, usually because I'm late....
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.