in reply to input - E-mail address - how to check string ?

Looks like your first regex is bogus - it will only match against local hostnames. But you have other problems too: you are reading from what may be different filehandles inside and outside the loop. You chomp outside, but chop inside.

Since "but its not working as expected." isn't really the best bug report in the world there may be other issues, but if you fix the DRY and the regex you should be half way there. eg.

my $email = ''; until ($email =~ /^[^ ,@]+\@([a-z0-9-]+\.)+[a-z]+$/) { print 'E-mail address: '; $email = <>; chomp $email; }

You can tweak the prompt and the regex until happy but that should get you started.

Replies are listed 'Best First'.
Re^2: input - E-mail address - how to check string ?
by zalezny (Novice) on Feb 25, 2015 at 10:05 UTC
    Thank You very much my friend! You just won, big virtual beer for Your help! Its working like a charm! http://nonjoiner.com/wp-content/uploads/2014/05/stockvault-beer-mug138814.jpg