Re: Adding a line in a file inside many directories
- From: Gunnar Hjalmarsson <noreply@xxxxxxxxx>
- Date: Fri, 29 Jun 2007 11:46:52 +0200
Ved wrote:
Joe I tried the code. This is what it is returning
######
File green_mcs020 /kat.s does not exist; skipping
File green_mcs0_40 /kat.s does not exist; skipping
File green_mcs0_20L /kat.s does not exist; skipping
File green_mcs0_40_20U /kat.s does not exist; skipping
#######
I think it is because the whitespace between the directory and file.
Directory file
green_mcs020(whitespace)/kat.s
Am I right ?
Sounds plausible...
I did some chomp in the code but it didn't help. From where this
whitespace is coming in ?
Maybe the file is corrupt. Try to run this from command line:
perl -pi -e 's/\s+$/\n/' my.tests
It should remove redundant trailing whitespace.
After adding chomps code looks like this now :
#!/usr/local/bin/perl
use strict;
use warnings;
my $dir_list = 'my.tests';
chomp $dir_list ; ## added by me
my $file_to_change = 'katana.sv';
chomp $file_to_change ; ## added by me
Please do not just do "some chomp". It's obvious that you don't know what that function does, so you'd better check the applicable docs:
perldoc -f chomp
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
.
- References:
- Adding a line in a file inside many directories
- From: Ved
- Re: Adding a line in a file inside many directories
- From: Joe Smith
- Re: Adding a line in a file inside many directories
- From: Ved
- Adding a line in a file inside many directories
- Prev by Date: Re: DBIx::Simple, fails with no error (not CGI this time!)
- Next by Date: Re: Adding a line in a file inside many directories
- Previous by thread: Re: Adding a line in a file inside many directories
- Next by thread: Re: Adding a line in a file inside many directories
- Index(es):
Relevant Pages
|
|