Logo
  • Home
  • About
  • Services
  • Career
  • Blogs
  • Contact
Logo

The UK's #1 Software Development Company. PodTech IO builds custom software solutions for businesses. Call today for a free consultation

  • Address

    4th Floor, 4 Tabernacle Street London EC2A 4LU
  • Email

    info@podtech.com
  • Contact

    +44 (0) 20 8720 6583

Tag Archives: Perl

  • Home
  • Tag Archives

Perl – Sending Email with NET::SMTP using username and password

  • By podtech
  • In Perl

Perl – Sending Email with NET::SMTP using username and password First of all double check that Authen::SASL is an installed module.. If you are not getting emails this could be why – it doesnt provide an error that is understandable! #!/usr/bin/perl ### ENSURE Authen::SASL is installed use Net::SMTP; use strict; use warnings; my $host= ‘yourhostname’; […]

Read More

Perl – Is a value decimal, real or a string?

  • By podtech
  • In Perl

Perl – Is a value decimal, real or a string? To validate if a number is a number using regex. [perl] $number = “12.3”; if ($number =~ /\D/) { print “has nondigits\n” } if ($number =~ /^\d+$/) { print “is a whole number\n” } if ($number =~ /^-?\d+$/) { print “is an integer\n” } if […]

Read More

Perl – Basic Fork Example

  • By podtech
  • In Perl

#!/usr/local/bin/perl   use strict; use warnings;   print “Starting main program\n”; my @childs;   for ( my $count = 1; $count <= 10; $count++) {         my $pid = fork();         if ($pid) {         # parent         #print “pid is $pid, parent $$\n”;         push(@childs, $pid);         } elsif ($pid == 0) {                 # child                 sub1($count);                 exit 0;         } else […]

Read More

Perl – Compare Array Contents when length is identical and order matches

  • By podtech
  • In Perl

Perl – Compare Array Contents when length is identical and order matches Comparing arrays side by side. Do they match or dont they? @a=(1,0,1,0,0); @b=(0,0,1,0,0); NO! @arr1=(0,1,1,1,1,1,0,1); @arr2=(0,1,1,1,1,1,0,1); use Algorithm::Diff qw( LCS_length); my $arr_count1 = @arr1; my $arr_count2 = @arr2; if($arr_count1 != $arr_count2) { print “NOMATCH\n”; ## NO MATCH } else { $count = LCS_length […]

Read More

Perl – Code Execution Time with accuracy – Time::HiRes

  • By podtech
  • In Perl

Perl – Code Execution Time with accuracy – Time::HiRes How long does it take to execute some code?   use Time::HiRes qw( time ); my $start = time(); // Code goes here sleep 10; my $end = time(); print “SPRINTF: “; printf(“%.6f\n”, $end – $start);      

Read More

PERL – Bitwise OR XOR an array

  • By podtech
  • In Perl

PERL – Bitwise OR XOR an array [perl] my @data= (“80″,”80″,”7B”,”30″,”32″,”30″,”38″,”31″,”46″,”30″,”39″); my $chk; foreach my $point(@data) { $chk = $chk^$point; ## XOR each array } $chk = hex($chk)|hex(“80”); ## OR the result value my $chk_hex=sprintf(“%x”,$chk); ## convert result to hex print “$chk = $chk_hex\n”; ## display both results side by side [/perl]

Read More

Perl DBH get last id

  • By podtech
  • In Perl

Perl DBH get last id SIMPLES with DBH Mysql   my $sth = $dbh->do(“$SQL”); my $id = $dbh->{‘mysql_insertid’};

Read More

Perl Hex to Binary to Decimal Conversions

  • By podtech
  • In Perl

Perl Hex to Binary to Decimal Conversions Dec to Hex Use function sprintf(“%x”, DECNUMBER) or sprintf(“%X”, DECNUMBER) for hexadecimal numbers with capital letters. $decvalue = 200; $hexvalue = sprintf(“%x”, $decvalue); ## gives c8 $hexvalue = sprintf(“%X”, $decvalue); ## gives C8 Dec to Oct Use sprintf(“%o”, DECNUMBER ) $decvalue = 200; $octval = sprintf( “%o”, $decvalue […]

Read More

PERL XOR 2 HEx values

  • By podtech
  • In Perl

PERL XOR 2 HEx values Need to XOR to hex values… try this. $NEW_VAL = hex(80) ^ hex(9D);    

Read More

Convert IP to HEX in Perl – one liner

  • By podtech
  • In Perl

Convert IP to HEX in Perl – one liner Strip out the IP.. $IP=”192168016012″; $IP = sprintf “%*vX”, “:”, $IP;   Vector hex conversion of IP    

Read More
  • 1
  • 2
  • 3
  • 4

Recent Posts

  • DevOps as a Software Development Methodology
  • How Does Spiral Software Development Methodology Work?
  • Waterfall Software Development Methodology And When To Use It
  • What Exactly Is Lean Software Development Methodology?
  • What is Kanban and How Does It Work?

PodTech IO

The UK's #1 Software Development Company. PodTech IO builds custom software solutions for businesses. Call today for a free consultation

Company

  • About
  • Services
  • Contact
  • Blogs
  • Career

Terms

  • Terms & Conditions
  • Privacy Policy

Contact Us

  • ADDRESS

    Headquarter: Tabernacle Street London India: Vi john Tower, Gurgaon, Haryana
  • EMAIL

    info@podtech.com
  • CONTACT

    +44 (0) 20 8720 6583

Copyright ©2023 PodTech IO. All Rights Reserved

Logo