2009/6/16 Irfan Sayed <irfan_sayed2...@yahoo.com>: > Hi All, Hello,
> I have perl script like this : > > use strict; > use warnings; > use Cwd; > my $chver; > my $fina; > &chversion(); &chversion() should be kept as simply chversion(); > sub chversion { > print STDERR "Current directory is " . cwd() . "\n"; > print "Reading version file\n"; > open (VER2, "<", > 'D:\hudson\workspace\RTU_Trunk_Build_Official\Trunk\versions.txt') or die > "Couldn't open versions.txt for reading: $!\n"; > while (<VER2>) { > $chver=$_; > } > print "$chver\n"; > open (VER1, "+>", > 'D:\hudson\workspace\RTU_Trunk_Build_Official\Trunk\Metrino\MonitoringSystem\Rtu\RtuInstallKit\EXFO > RTU System\EXFO RTU System') or die "Couldn't open versions.txt for > read/write: $!\n"; > print "Hi\n"; I think you have a error in the open/while loop. According to perlopentut (#Mixing Reads and Writes) the command is open(SCREEN, "+> /tmp/lkscreen") || die "can't open /tmp/lkscreen: $!"; I suspect that your opened the file to write/append and then slurping it in a while loop but it's not opened in the correct mode so there is nothing coming in. So rather than using the 3 argument open, you want the 2 argument as above. > while (<VER1>) { > print "HI\n"; > if ($_ =~ m/"OutputFilename"/) { > print "Match found\n"; > $fina =~ s/$_/{.*}$chver.msi/; > } > > } > print "$fina\n"; > close VER1; > } > This is just my opinion, I haven't tested anything :-0 Dp. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/