#!/usr/bin/perl use strict; use warnings; use IO::All; use 5.010; $| = 1; while (<>) { my $status = io('status.txt')->all; my $url = ( split )[0]; if( not $status # almost same as if( $status == 0 ) and $url =~ /\Q123.1.34.107:8080\E/ ) { say "301:http://123.1.34.107:8080/Web" } else { say $url } }