PERL

  1. PERL: How to remove an element from hash or array?

    In order to remove an element from the array or hash, we have to use the delete keyword on perl. Using the delete keyword on the key of the hash or array (numeric keyed hash), we can delete elements of a hash or array.

    Example …

    read on

  2. Resolve Net::MySQL Hang problem if the database result has only 1 row or is empty

    Net::MySQL is a simple MySQL perl Client to connect to MySQL servers. But Net::MySQL hangs if your result set is having just one row.

    Sample Net::MySQL code

    #!/usr/bin/perl use Net::MySQL; $mysql = Net::MySQL->new( hostname => 'localhost', database => 'db', user => 'user', password = … read on

  3. Error Installing PERL modules "unrecognized command line option -fstack -protector"

    Error Installing PERL modules "unrecognized command line option -fstack -protector"

    unrecognized command line option "-fstack-protector" error usually comes on Cygwin when installing PERL modules. For example when installing the DBI module or DBD::MySQL perl module, the following error comes on cygwin :

    cp lib/DBI/Gofer/Serializer/Base.pm blib/lib/DBI/Gofer/Serializer/Base.pm cp dbipport.h blib/arch/auto/DBI/dbipport.h cp lib/DBI/Gofer/Execute.pm blib/lib/DBI/Gofer/Execute.pm cp lib/DBI/DBD.pm blib/lib/DBI/DBD.pm cp … read on

  4. Make WWW::Mechanize do not exit on GET Errors

    When using PERL and WWW::Mechanize, your script can stop if there is some error in GETing a URL (such as 404 Not Found, 403 Permission Denied). Instead of resuming, the script terminates. If you want the script to continue resuming, you have to pass

    autocheck …

    read on

  5. Perl Script to Fetch PNR Status reservation on train from Indian Railways

    The code below is a perl script that fetches the PNR status from the indianrail.gov.in website and displays it on the command line.

    Warning: No one is authorised to make any type of commercial usage like putting web advertisements or SMS service and Reproducing/Transmitting/Storing in …

    read on

  6. Perl Script to send Free SMS to any mobile number in INDIA using way2sms

    The following script sends SMS to any number in INDIA using the free service provided by Way2Sms.com Requires WWW::Mechanize and Compress::Zlib libraries.

    Please remember to fill the username and password in the fields that is mentioned in the script.

    Updated code on 28th October 2011. …

    read on

  7. Perl script to remove a directory and contents recursively

    This is the script for sandeep when he asked me how to delete a directory in perl. rmdir function only removes empty directories. So we need to remove the contents of the directory before removing the directory. So if the directory contains more directories / …

    read on

Tags
On Facebook
Email Newsletter