#!/usr/contrib/bin/perl # Parses a string in the format: # REFDATA_ERROR[type=<1>,system=<2>,category=<3>,code=<4>] # Prints out the four parameters, <1>, <2>, <3>, <4> sub parse_error($) { $params =~ m/REFDATA_ERROR\[type=(.*),system=(.*),category=(.*),code=(.*)\]/; print "$params\n"; print "$1\n"; print "$2\n"; print "$3\n"; print "$4\n"; } # Main parse_error("REFDATA_ERROR[type=val1,system=val2,category=val3,code=val4]");