Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Perl tutorials?

  1. #1
    New Coder
    Join Date
    Oct 2010
    Posts
    10
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Perl tutorials?

    can anyone provide some easy to follow guides on how to perl program. im struggling with this topic in university.

    i can write the code in PSPad but find broblems tring to view the form that was created. i am trying to view it within a web browser as it creates a form. a few class mates said i need another file. not sure what this is or why i need it.

    for example, this is an example of code for a date checker that we are given but i cant view the form in the web browser.

    #!c:/perl/bin/perl
    use CGI ':standard';
    print header, start_html('Date Check');
    $date=param('udate');
    if ( $date =~ m{^\d\d/[0-3]\d/2\d\d\d$} ) {
    print 'Valid date=', $date;
    } else {
    print 'Invalid date=', $date;
    }
    print end_html;

  • #2
    120
    120 is offline
    Regular Coder
    Join Date
    Nov 2009
    Location
    UK
    Posts
    105
    Thanks
    6
    Thanked 15 Times in 15 Posts
    The excellent 'Beginning Perl' is available online for free:
    http://www.perl.org/books/beginning-perl/

    Personally, the very first place to start would be 'hello world' just to check the installation is working.

    There is always plenty of idol work for the devils hands to do
    Registered Linux User 475075 : Project Honeypot

  • #3
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    Can't say I am familair with the various shebang lines but your regex could be improved


    Code:
    #!c:/perl/bin/perl
    use CGI ':standard';
    print header, start_html('Date Check');
    $date=param('udate'); # assuming date is like this, 2010-11-03 
    if ( $date =~ /^(\d{4})-(\d{2})-(\d{2})$/
    print 'Valid date=', $date;
    } else {
    print 'Invalid date=', $date;
    }
    print end_html;
    there is a ton of information here in CF to help you learn. Best is to have a project (of whatever size), which gives a necessity to making some code.

    are you familiar with cpan? loads of modules to help make programming simpler and more efficient.

    bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •