while (my $line = ) { #Do stuff with $line $line =~ s/rotate\(-180/rotate\(-0/g; #etc }