开发者

Save Temp Word Perl Single Quote

开发者 https://www.devze.com 2023-03-09 01:24 出处:网络
i am trying to save hello world with single quote in temporary file i open temporary file hello world show without single quote

i am trying to save hello world with single quote in temporary file i open temporary file hello world show without single quote how to solve this

#!/usr/bin/perl -w
chomp($TMPFILE = `mktemp bumatinaskk.XXXXXXXXXX`);
$echo = "echo \'hell开发者_Python百科o word\' >>$TMPFILE";
system ("$echo");


use 5.010;
use strict;
use warnings FATAL => 'all';
use autodie;
use File::Temp qw(tempfile);
use IO::File qw();

my ($file_handle, $file_name) = tempfile('bumatinaskk.XXXXXXXXXX', UNLINK => 1);
$file_handle->say(q{'hello world'});
$file_handle->close;
say "wrote into temporary file $file_name";

sleep 30;   # giving you some time to inspect the temporary file

END { say 'temporary file is going to be deleted now' }

Documentation: File::Temp, IO::File

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号