---
title: "perl中去掉字符串中空格"
author: "luogen33"
date: "2011-09-26T22:02:33Z"
tags: []
categories: ["编程语言"]
slug: "perl"
draft: false
lastmod: "2011-09-26T22:02:33Z"
id: 1181000
url: "https://luogen33.iteye.com/blog/1181000"
---

Perl code


use strict;
use warnings;

my $str=" \n aaa bbb\n ";
$str=~s/^\s+|\s+$//g;
print($str);
^D
aaa bbb