in reply to [SOLVED]substitution using hash issue

  1. use strict; This is a good friend.
  2. Declare your variables:  my %dates = ...
  3. 01 is an octal number (one). 08 is an illegal number representation. What you want is text, so write text with quotes: my %dates = ( 'Jan' => '01', #...
  4. $dates{'Dec'} contains "12". So, forget regex substitution: print "$day $dates{$month} $year\n";
  5. There is a lot of caveats with dates. Consider well known CPAN modules like DateTime...

#!/usr/bin/perl use strict; my %dates = ( 'Jan' => '01', 'Feb' => '02', 'Mar' => '03', 'Apr' => '04', 'May' => '05', 'Jun' => '06', 'Jul' => '07', 'Aug' => '08', 'Sep' => '09', 'Oct' => '10', 'Nov' => '11', 'Dec' => '12', ); my $date = "30/Feb/2013"; my ($day,$month,$year) = split '/', $date; print "$day $dates{$month} $year\n";

English is not my mother tongue.
Les tongues de ma mère sont "made in France".