mtrasp has asked for the wisdom of the Perl Monks concerning the following question:
HI i am new to perl.. please help me iam getting error at @INFFiles = `dir /b $filespec`; foreach loop is not executing and iam not understanding this part $VersionNumber =~ s/^\d+\.\d+\.\d+\.\d+//g; and $VersionNumber =~s/\x0d//g; please Guide me what i need to learn to understand this code.
sub FileVersion($$$) { my ($path, $fileName, VersionID) = @_; if ("" eq $fileName) { $filespec = "$path\\*.inf"; } else { $filespec = "$path\\$fileName"; } @INFFiles = `dir /b $filespec`; foreach $infFile (@INFFiles) { chomp $infFile; $infFile = "$path\\$infFile"; $encoding = GetFileEncoding($infFile); open(INF, "<:encoding($encoding)", "$infFile") || writelog(log +die,"Could not open $path\\$infFile"); @Contents = <INF>; @match = grep(/DriverVer=/, @Contents); close INF; } my ($prefix, $VersionNumber) = split(',', $match[0]); $VersionNumber =~ s/[^\d+\.\d+\.\d+\.\d+]//g; $VersionNumber =~ s/\x0d//g; chomp $VersionNumber; writelog(debug,"pr_UpdateFileVersion $MyVersionID, $VersionNumber" +); ExecStoredProcedure("pr_UpdateFileVersion", "$MyVersionID,'$Versio +nNumber'"); return $VersionNumber; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Please help me
by jwkrahn (Abbot) on Feb 12, 2010 at 05:27 UTC | |
|
Re: Please help me
by FalseVinylShrub (Chaplain) on Feb 12, 2010 at 06:17 UTC | |
by Jenda (Abbot) on Feb 12, 2010 at 10:15 UTC | |
by FalseVinylShrub (Chaplain) on Feb 12, 2010 at 10:31 UTC | |
by mtrasp (Acolyte) on Feb 18, 2010 at 08:15 UTC | |
by FalseVinylShrub (Chaplain) on Feb 18, 2010 at 12:19 UTC | |
|
Re: Please help me
by TGI (Parson) on Feb 12, 2010 at 15:24 UTC | |
by mtrasp (Acolyte) on Feb 12, 2010 at 18:17 UTC | |
by TGI (Parson) on Feb 18, 2010 at 22:59 UTC |