#!/usr/bin/perl use strict; use warnings; #### untested #### open my $fh_transfile, '<', "filename" or die "unable to open translation file $!"; my %table; while my $line (<$fh_transfile>) { my($nat_ip, $real_ip) = split ' ', $line; $table{$nat_ip} = $real_ip; } close $fh_transfile; open my $fh_bigfile , '<', "filename" or die "unable to open big input file $!"; open my $fh_out, '>', "filenameout" or die "unable to open big output file $!" while my $line (<$fh_bigfile>) { chomp $line; my @tokens = split ',',$line; if ($table{$tokens[8]}) { $tokens[8] = $table{$tokens[8]}; } print $fh_out join(",",@tokens),"\n"; } #### use strict; use warnings; use Data::Dumper; my $line = " X Y \tZ A \n"; my @tokens = split ' ', $line; print Dumper \@tokens; @tokens = split /\s+/, $line; print Dumper \@tokens; __END__ $VAR1 = [ #split ' ' version 'X', #note ending removed 'Y', 'Z', 'A' ]; $VAR1 = [ #split /\s+/ version '', #note ending removed 'X', 'Y', 'Z', 'A' ];