我试图用推力补充阵列中的所有内容。 之后,i 储存在另一个档案中
但是,从档案开始,看到每个东西都有一个白人和平组织。
问题何在。
open FILE , "a.txt"
while (<FILE>)
{
my $temp =$_;
push @array ,$temp;
}
close(FILE);
open FILE2, "b.txt";
print FILE2 "@array";
close FILE2;
我试图用推力补充阵列中的所有内容。 之后,i 储存在另一个档案中
但是,从档案开始,看到每个东西都有一个白人和平组织。
问题何在。
open FILE , "a.txt"
while (<FILE>)
{
my $temp =$_;
push @array ,$temp;
}
close(FILE);
open FILE2, "b.txt";
print FILE2 "@array";
close FILE2;
当你引用像以下几组变量:@array”
时,它便与空间发生干扰。 这是你们的产出。 因此,如果你不需要或想要进行这种干涉,则不会援引。
现在让我把你的节目改写到现代的Perl。
use strict;
use warnings FATAL => all ;
use autodie qw(:all);
my @array;
{
open my $in, < , a.txt ;
@array = <$in>;
}
{
open my $out, > , b.txt ;
print {$out} @array;
}
页: 1 这使得它成为一种扼杀性污染,对阵列而言,它相当于<条码>join($),@array)。 <代码>$>的缺省值是(猜测什么?)一个空间。
提 出
print FILE2 @array;
你想说
open FILE2, > , "b.txt"
如果你走下了这条路,
use warnings;
页: 1 口译人员将按字面处理很多问题。
I am building a Web interface to monitor an embedded system. I have built a Perl script which runs remote commands and gathers output from that system. Now what I need is a Web interface which makes ...
How do I tell what type of value is in a Perl variable? $x might be a scalar, a ref to an array or a ref to a hash (or maybe other things).
When I try a "chdir" with a filehandle as argument, "chdir" returns 0 and a pwd returns still the same directory. Should that be so? I tried this, because in the documentation to chdir I found: "...
I ve read the doc for GetOptions but I can t seem to find what I need... (maybe I am blind) What I want to do is to parse command line like this myperlscript.pl -mode [sth] [inputfile] I can use ...
I m a little confused about what is going on in Perl constructors. I found these two examples perldoc perlbot. package Foo; #In Perl, the constructor is just a subroutine called new. sub new { #I ...
I would like to submit a form to a CGI script localy (w3c-markup-validator), but it is too slow using curl and apache, I want to use this CGI script more than 5,000 times in an another script. and ...
So I m running perl 5.10 on a core 2 duo macbook pro compiled with threading support: usethreads=define, useithreads=define. I ve got a simple script to read 4 gzipped files containing aroud 750000 ...
A Google search yields a number of results - but which ones are the best? The Perl site appears to contain two - perlboot and perltoot. I m reading these now, but what else is out there? Note: I ve ...