perl中的空格错误

时间:2016-05-21 11:29:40

标签: linux perl

我写了这段代码:

create table tab1(Col1 int,col2 varchar(10), col3 varchar(10))

insert into tab1
values(1,'p1','1.0'),
(1,'p1','1.1'),
(1,'p1','1.2')

create table tab2(Col1 int,col2 varchar(10), col3 varchar(10))

insert into tab2
values(1,'p1','2.0'),
(1,'p1','2.1'),
(1,'p1','2.2')

SELECT a.col1,a.col2,a.col3,b.col3
FROM
(
    select 
    *,ROW_NUMBER() over(order by col1) as rownum
    from tab1
)a
inner join 
(
    select *,ROW_NUMBER() over(order by col1) as rownum
    from tab2
)b ON a.rownum = b.rownum and a.Col1 = b.Col1

结果来了:

my $dizin = "/home/$kullaniciadi/public_html/dosya.txt";
print $dizin;

但我希望它是/home/neguzel /public_html 。我不希望它是

/home/username/public_html

如何删除换行符?

1 个答案:

答案 0 :(得分:3)

您需要chomp您的输入。它有一个换行符。 chomp会为您移除该换行符\n

my $kullaniciadi = <STDIN>;
chomp $kullaniciadi;

my $dizin = "/home/$kullaniciadi/public_html/meme.txt";
print $dizin;