March 13, 200917 yr Hi, Im very new to Perl and am stuck trying to write a small program. I need it to accept a file (text), if one is not present then i need it to ask ask the user for the filename input. Then check that the filename is no longer than 8 characters in lenght, with no digits as the 1st character. Then check that it has a .TXT extension - if no to add one. Also, If i remove the warnings from the top of the script - it wont run at all?? Here is what i have written so far: !#c:\Perl\bin\perl.exe warnings; if($#ARGV == -1) { print("Enter a FileName Please: "); $filename = <STDIN>; chomp($filename); } else { $filename = $ARGV[0]; } if ($filename =! m/[a-z_A-Z]{1}[\w]{1,7}/i) { die("Not valid\n"); } if($filename =! m/\.txt/i) { $filename .= ".TXT"; } I keep on getting the die message of NOT VALID. why is this?? Thanks in advance
March 13, 200917 yr What are you using for a reference/learning guide? It's ages since I did Perl and I don't recognize some of commands you're using
March 13, 200917 yr Author What are you using for a reference/learning guide? It's ages since I did Perl and I don't recognize some of commands you're using Im studying a course at home so i am using the course books they gave me. I have taken a quick glance at an online Perl Tut tho, Beginning Perl.
March 13, 200917 yr Hi I don't know anyting about perl but being as it's server side what are you testing it on? Could it be to do with that?
March 13, 200917 yr Author Hi I don't know anyting about perl but being as it's server side what are you testing it on? Could it be to do with that? Im using windows. I have downloaded the correct perl files yes and have written a few succesful little programs so far. But for some reason i cannot get this one to work and i dont know why!!!!
March 14, 200917 yr Author Does anybody have a good link to a perl forum?? Or any Perl experience themselves?
March 14, 200917 yr I think you may have hit on the problem. There are hardly any Perl posts on these forums, and everyone who's involved in server-side coding seems to have picked PHP (which is much easier, let's face it!). So I'm afraid this is a dreaded "sorry I can't help" post, but I'm just trying to explain why...
Create an account or sign in to comment