#C:\strawberry\perl\bin\perl.exe my $filename = "input.txt"; open my $file, '<', $filename; @fileinput=<$file>; close($file); #while($file) #{ my $line =$_; # $line=~s/(\d{2}\/\d{2}\/\d{4})/($3\/$1\/$2)/g; #print "@listinput"; # change date format foreach $line(@fileinput) { my $testdate=($line); #= "11/09/2009"; if($testdate =~s/(\d{2})\/(\d{2})\/(\d{4})/$3\/$1\/$2/g) { print $testdate; #=~s/(\d{2}\/\d{2}\/\d{4})/($3\/$1\/$2)/; } if($testdate =~s/(\d{4})(\d{2})(\d{2})/$1\/$2\/$3/) { print $testdate; } if($testdate =~s/(\w{4})\s(\d{2})\,\s(\d{4})/$3\/$1\/$2/) { print $testdate; } if($testdate =~s/(\d{2})\-(\d{2})\-(\d{4})/$3\/$1\/$2/) { print $testdate; } } #Wrong,It also change the date #foreach $line(@fileinput) #{ #my $numToword=($line); #$num = "9"; #$word = "nine"; #if($numToword =~s/$num/$word/g) # { # print $numToword; # } #$num = "19"; #$word = "nineteen"; #if($numToword =~s/$num/$word/g) # { # print $numToword; # } #$num = "10"; #$word = "ten"; #if($numToword =~s/$num/$word/g) # { # print $numToword; # } #$num = "5"; #$word = "five"; #if($numToword =~s/$num/$word/g) # { # print $numToword; # } #} # Capilize the first character after AU: foreach $line(@fileinput) { my $Cword=($line); if($Cword=s/(^AU:\s[a-z])/(^AU:\s[A-Z])/) { print $Cword; } } #extract ID in () foreach $line(@fileinput) {my $extractid=($line); if($extractid =~m/\( (\d+)\)/g) { print $extractid; } } #remove END, end word in file foreach $line(@fileinput) { my $removeend=($line); if($removeend=~s/(^END) | (^end) | (END$) |(end$)//g) { print $removeend; } } #$line=~s/(\d{2}\/\d{2}\/\d{4})/($3\/$1\/$2)/g; #print $line; #}