#!/bin/perl -w use strict; my %hash; while( <>) { # note: the left part should be just one character $hash{$2}= $1 if( m/^\s*(.)\s*::=\s*([^\s]*)\s*$/); } while( my($key, $value)= each %hash) { print "/$key/ ::= /$value/\n"; }