Newsgroups: comp.lang.perl.misc
From: "A. Sinan Unur" <1...@llenroc.ude.invalid>
Date: Fri, 16 May 2008 10:41:09 GMT
Local: Fri, May 16 2008 6:41 am
Subject: Re: write 10 files
"Ela" <e...@yantai.org> wrote in
news:g0jl3m$cj$1@ijustice.itsc.cuhk.edu.hk: > The following codes are not accepted by Perl and even string Doesn't work is not a good problem description. > concatenation doesn't work. > Any suggestions? See below. > #!/usr/bin/perl use strict; use warnings; > $infile = $ARGV[0]; You realize that loops 11 times, right? > foreach $k (0..10) { > $outfile = $infile . $k; First off, you should check if open succeeded. Second, what makes you > open (OFP$k, ">$outfile"); think you can use OFP$k where Perl expects a filehandle. This looks like a very poor attempt at using symbolic file handles (if When you find yourself wanting to index something using an integer, you > } #!/usr/bin/perl > $i = $size/10000; use strict; my ($prefix) = @ARGV; my @out; for my $i ( 0 .. 9 ) { } for my $file ( @out ) { my $handle = $file->{handle}; my $name = $file->{name}; print $handle "This is $name\n"; unless ( close $handle ) { warn "Error closing '$name': $!"; } undef $file->{handle}; } __END__ Sinan -- comp.lang.perl.misc guidelines on the WWW: You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||