#!/usr/bin/perl ## Copyright (C) 2008 Tim Dunphy use strict; my $file = $ARGV[0]; if (!$file) { print "Hey! You didn't give me a file, sucka!\n"; } my $out = $file; $out =~ s/\.\w+?$/.out/; open IN, "<$file" or die "File did not open\n"; open OUT, ">$out" or die "File not available for write.\n"; while () { $_ =~ s/fred/\n/i; $_ =~ s/wilma/Fred/i; $_ =~ s/\n/Wilma/; print OUT; } #### fred wilma wilma fred wilmafred fredwilma wilma&fred fred&wilma #### Wilma FredWilmaFredWilmaWilma FredWilma WilmaFred Fred&Wilma Wilma&Fred Wilma