optimize solution perl