Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

PERL help!

Featured Replies

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

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

  • 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.

  • Author

Everything i try it keeps saying NOT VALID??

Strange.

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?

  • 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!!!!

  • Author

Does anybody have a good link to a perl forum??

 

Or any Perl experience themselves?

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.