String Connection Issue

Posted by Nano HE on Stack Overflow See other posts from Stack Overflow or by Nano HE
Published on 2010-04-11T10:07:43Z Indexed on 2010/04/11 10:13 UTC
Read the original article Hit count: 351

Filed under:
|

Hi, Could you please have a look at my code below.

#!C:\Perl\bin\perl.exe 
use strict; 
use warnings; 
use Data::Dumper;  

my $fh = \*DATA;  
my $str1 = "listBox1.Items.Add(\"";
my $str2 = "\")\;";

while(my $line = <$fh>)
{
    $line=~s/^\s+//g;

    print $str1.$line.$str2;

    chomp($line);

}


__DATA__  
Hello
 World

Output:

D:\learning\perl>test.pl
listBox1.Items.Add("Hello
");listBox1.Items.Add("World
");
D:\learning\perl>

Style error. I want the style below. Is ther anything wrong about my code? thanks.

D:\learning\perl>test.pl
listBox1.Items.Add("Hello");
listBox1.Items.Add("World");
D:\learning\perl>

© Stack Overflow or respective owner

Related posts about perl

Related posts about connection-string