Hello All, I am having a problem that should be very simple. I cannot figure this out for the life of me.
I have a business need where I need to change a literal in a zip file from one string to another. Specifically, I need to change a filename embedded in the zip file (the one that would be extracted) with something else. Because the process is owned by another group and how things are configured here (running multiple runs simulatenously), I am stuck with trying to come up with a creative solution. Here is what I have: #----------------------- start $ cat runme export WORKFILE=13646 export REALFILE=TRANS cat outfile.zip | perl -e ' use strict; use warnings; my $sw = 0; my $rc = 0; my $line = ""; open(OUT, "> temp.zip") or die; while ($line = <>) { if (! $sw) { $rc = $line =~ s/$ENV{WORKFILE}/ENV{REAL}/; print STDERR "rc = $rc\n"; print OUT $line; $sw++; } else { print OUT $line; } } close(OUT); ' $ runme rc = $ unzip -t temp.zip Archive: temp.zip testing: 13646 OK No errors detected in compressed data of temp.zip. $ #----------------------- end I don't understand why my $rc line is null either. The obvious solution is to change the input filename before the file gets "zipped", but as mentioned, this is done by another group. Any help would be appreciated. Thanks so much, Jeff