[Edited 2001-05-08, ar0n - Moved to SOPW ]#!/usr/local/bin/perl use strict; my $string; my $string_1="This program cannot be run in DOS mode."; my $string_2="somethingelse in the file"; open(ORIG,"<old.dll") || die "Cannot open file! $!"; open(NEW,">new.dll") || die "Cannot creat new file! $!"; binmode ORIG; while(<ORIG>){ $string.= $_; } $string=~s/(.*)($string_1)(.*)($string_2)(.*)/$1$4$3$2$5/g; binmode NEW; print NEW $string; close(ORIG); close(NEW); exit();
In reply to how do I swap 2 strings in a file? by babyconejo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |