$file =~ /^(\d+)([A-Z][a-z]+)([A-Z][a-z]+)\.(.*)$/; print "Serial : $1\n"; print "Name : $2\n"; print "Category : $3\n"; print "Extension: $4\n"; #though... you may want to change [a-z] to include any other possible chars