The o/p i am expecting as $file = /test/var/XXX001 /test/var/...... /test/var/XXX01B #but i am getting o/p as XX001BC YY001BC ...... ...... /test/var/0