[PLUG] perl question

Daniel Herrington herda05 at gmail.com
Fri May 29 20:54:50 UTC 2009


All,

I'm at a loss about why this simple concatenation is not working. I'm
pulling a value from a hash and attempting to concatenate ".cal" on the end.


        $Cal_ref = {
            'cal_name'  => $cal_name,
            'dates'     => \@dates,
            'desc'    => $cal_desc
        };

        $twsCalendars[$i] = $Cal_ref;
        $i++;
...

for (my $i = 0; $i < $length; $i++) {
    # cycle through the list and print all the calendar names
    my $c_href = $twsCalendars[$i];
    my $cal_name = $$c_href{'cal_name'};
    my $foo = ".cal";
    my $var1 = $cal_name . "$foo";
    print ("$cal_name\n");
    print ("$var1");
    print "\n";
    print ("    $var1");
    print "\n";

This outputs the following:

BCPFTPCL
.calTPCL
.calBCPFTPCL

Whatever I try, I can't concatenate the ".cal" on the end of $cal_name. I've
moved quotes around, attempted the concatenation to the same var ($cal_name
= $cal_name . $foo) but nothing seems to work. It seems there are invisible
characters or $cal_name isn't scalar (I have even forced a scalar context on
$cal_name, no change in result).

thanks,

-- 
Daniel B. Herrington
Director of Field Services
Robert Mark Technologies
dherrington at robertmarktechnologies.com
o: 651-769-2574
m: 503-358-8575



More information about the PLUG mailing list