[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x

Perl

26K

Solutions

10K

Contributors

Perl is a high-level, general-purpose, interpreted, dynamic programming languages with over 25 years of development. Perl 5 runs on over 100 platforms from portables to mainframes and is suitable for both rapid prototyping and large-scale development projects.  Perl gained widespread popularity as a Common Gateway Interface (CGI) scripting language, in part due to its regular expression and string parsing abilities. In addition to CGI, Perl is used for graphics programming, system administration, network programming, finance, bioinformatics, and other applications.

Share tech news, updates, or what's on your mind.

Sign up to Post

Nagios Core 4.3.4
Nsclient 4.3
Windows 10

Just restarted my Windows 10 Desktop VM after November Updates and Nagios reports this warning on two checks

 Error: Can't locate perl510.dll


Check Windows Temp Folder WARNING 11-14-2018 22:01:47 0d 0h 32m 58s 10/10 Error: Can't locate perl510.dll


Explorer WARNING 11-14-2018 22:28:58 0d 0h 33m 34s 20/20 Error: Can't locate perl510.dll

I have the exact same checks on other Windows 10 VMs and Physical Windows 10 Desktop and they all work

I have no perl program installed on any of y computers

Searching for this dll shows nothing any where.


Any ideas?
0
Bootstrap 4: Exploring New Features
LVL 12
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

Hi, we have a gift certificate form. magickitchen.com/gift/gift-certificates.html  - cart is written in PERL,

In the amount window, if someone enters a dollar sign before the number, they get an error. Error: Invalid input for VALUE: $|$35|

Is there a simple way to remove the $ sign if someone enters it, as the form is submitted? Or is there another simple solution?

As an interim measure, I'll be changing the placeholder text. Thanks.
0
On a new RHEL 7.5 server, I'm trying to get mod_fcgid to run on a simple perl script. I had previously been using mod_perl on an older server, with no issues.  I have confirmed that fcgi_module is installed and running. Server is Apache 2.4.6.

httpd.conf:
AddHandler fcgid-script .fcgi

hello.fcgi:
#!/usr/bin/perl
print "Content-Type: text/html\n\n";
print "hello world";

Error log:
[Fri Oct 12 17:33:50.655808 2018] [fcgid:warn] [pid 13551] (104)Connection reset by peer: [client xxx.xxx.xxx.xxx:xxxxxxx] mod_fcgid: error reading data from FastCGI server
[Fri Oct 12 17:33:50.655891 2018] [core:error] [pid 13551] [client xxx.xxx.xxx.xxx:xxxxxx] End of script output before headers: hello.fcgi
0
Experts,

In a file I need to have the possibility to grep a pattern in the first or in the second column.  If found the entire line is returned.
Comes with it that that pattern is a variable.

Grepping the var in the first column is easy, but I can't get it to work for the second column (sep is >).

var=MSPROXML


MSUPDSEOT>MSPROXMLH
VSRFUMVTT>MSPROXMLH
FT0Y6600_T>MSPROXMLH
MSINSMSGT>MSPROXMLH
MSPROXMLT>XGGENEXTH
MSPROXMLT>CD0E0100_H
MSPROXMLT>FT0Y3600_H
MSPROXMLT>PC0R3420_H
MSPROXMLT>WO0A0020_H

This is what would need to be returned:

MSUPDSEOT>MSPROXMLH
VSRFUMVTT>MSPROXMLH
FT0Y6600_T>MSPROXMLH
MSINSMSGT>MSPROXMLH

Thank you for  your help.
Watnog
0
Hi Everyone

I have a perl script and I have an array and am using a foreach and am looping many times to update an XML file.
There are 2 foreach loops in the script. The outer loop is the data and the inner is searching the XML file to add the data to the specific node.
I'm using the XML::LibXML to search and add.

My question is:

Once I use the element in the array I want to get rid of it to make the foreach loop execute faster as the array would decrease in size.

The program now runs 3 hours. It would be good to speed it up.

Is there an easy way to do this?

Thanks for the help

Mike
0
Hello Friends,

Is there any way to use floating point numbers in rrdtool? Some patch? Some RRDTool fork?

The reason for the question is that I would like to use the RRDTool to monitor balance / quote of cryptocurrencies...  For security reasons I do not want to use any existing tools for this... (yes, I'm a bit paranoid)  :)
0
In my current Perl script I want to modify a string that identifies my database RAC zone cluster.  Currently using:  nslookup `hostname` to get my fully qualified hostname.  However, this is not the name I need to use for my network administration HOST string in my "tnsnames.ora" file.  So, please help me modify this string:
   
       An example   dbserver01.dpsn.local  -->  need this string to be  dbzonecluster.01.dpsn.local

In general I will always want to replace what comes before the first '.' character in the file with some predefined string.  Can't figure out how Perl function substr would help, or something like  $myZoneClusterName =~ s/xxxxx/yyyy/g
0
My plan is to automate our current Database STIG Audit process.  I want to write a short Perl script to:

   1)  Read XML STIG File (i.e.  U_Oracle_Database_12c_V1R10_Manual-xccdf.xml)
   2)  Parse out all the STIG #s, with the accompanying SQL Query Statements
   3)  Write new ascii text output to new file

Please help me with Perl file example to do this parsing?
U_Oracle_Database_12c_STIG_V1R10_Man.xml
0
I had this question after viewing Unix AIX compare column of 2 files.

Hi Experts,
I try to make these lines work:

#!/bin/ksh
file1=file1.txt
file2=file2.txt
while read LINE ; do
FileSystem=`echo $LINE | awk '{print $3}'`
GrowthTreshold=`echo $LINE | awk '{print $5}'`
if [ "$GrowthTreshold" -ge 0 ] 2>/dev/null  ; then
echo $GrowthTreshold
perl -ane '$k=$F[0].$F[2]; print if exists($h{$k}) && $F[3]-$h{$k}>='$GrowthTreshold'; $h{$k}=$F[3]' $file1 $file2 >>ExceptionList.txt
else
echo ""$FileSystem" could not be checked"
fi
done <$file1.txt

###

I attach a file1.txt and a file2.txt

Values of file2.txt are compared to those of file1.txt
In this example:
- the first line is one that should be logged: 78 to 88 = 10 so that exceeds the allowed growth treshold of 5
- and also the last line: 34 to 40 = 6 so that exceeds of the allowed growth treshold of 5

When I run the script as it is now this is returned:

...
syntax error at -e line 1, near ">=;"
Execution of -e aborted due to compilation errors.


Thank you for your help.
Watnog
file1.txt
file2.txt
0
I'm trying to ingest a large text file into PostgreSQL Full details here

I may need to run  a script against the file to either remove the problem rows into a separate file, or insert into the database via DBI and was wondering how perl handles diacritics?

I'm sure perls native I/O file handle is UTF8 but not certain about the diacritics or non roman characters
0
Angular Fundamentals
LVL 12
Angular Fundamentals

Learn the fundamentals of Angular 2, a JavaScript framework for developing dynamic single page applications.

Hi
I need to run multiple sql queries (These are built elsewhere in the script  with no possibly why of introducing SQL injection)

Rather than writing multiple prepare /   execute statements I thought about  using a foreach loop something like bellow but I get error
Use of uninitialized value $sql in concatenation (.) or string at main.pl line 19.

Any idea how I might do this?

use strict;
use warnings;
use  DBI;
my $dbi = DBI->connect('DB Connection string', {
    PrintError =>0;
    HandleError => "OH No!"}
)or print DBI->errstr;
# built elsewhare
my $Q1 = "insert into my_table 'ABC'";
my $Q2 = "insert into my_table 'EFG'";
my $Q3 = "insert into my_table 'XYZ'";

foreach($Q1,$Q2,$Q3){
   my $sql = $1; 
    print $sql . "\n";  # line 19
#    my $qa = $dbh->prepare($sql);
#    $qa->execute();
#    if(defined(DBI->errstr)){
 #       print DBI->errstr . "\n";
  #  }
}

Open in new window

0
Hello
I changed the top of the page from guestbook.html, addguest.html and guestlog.html
     <?xml version="1.0" encoding="iso-8859-1"?>  to   <?xml version="1.0" encoding="utf-8"?>
And also add
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
But some garbage value appears on the screen instead of Urdu ( Pakistani Language) .
Then I changed all encoding="iso-8859-1   to   encoding="utf-8" in guestbook.pl but same garbage value appears on the screen instead of Urdu.
nms-guestbook is very attractive and I want to use it, so please help me.

 kindly check this link http://www.punjabiandpunjab.com/guestbook.html
Thanks
0
<FileDetails>
 <FileName>abcd<1234</FileName>
 <FileSize>10KB</FileSize>
</FileDetails>

how to parse this in perl
0
how to compile 64 bit version of libperl.a from perl 5.28 source code on solaris.

Tried with -fPIC while configuring. But, no luck.
0
hi,

I am setting up the first MySQL cluster and I need to install the auto install rpm first, but that one said it depends on community server rpm first, which asking for the client to be install, but when I install the client it complain:

when installing MySQL client
so how can I get ride of that error when installing the client?

what is perl (Class::MethodMaker) ? how to install it?

I download all component from https://dev.mysql.com/downloads/cluster/

and now the files list is:

MySQL  Cluster binary downloaded.
anything missed?
0
Hi experts,

Need help on how to convert a string of values in both 2nd and 3rd fields that are actually Date and Time in GMT and then calculate the difference in seconds.
Preferably using the following scripting methods:  BASH or PERL

Sample source file in CSV:  inputfile.csv

Label,StartDateTime,EndDateTime,status
info01,20171231155000,20171231161000,complete
info02,20180101023025,20180101024045,complete
info03,20180430222210,20180430223002,complete
info04,20180612113050,20180612113502,complete

Open in new window




===============================================================================================

Required Output File: Start and End Date/Time in GMT+8, plus the Date/Time difference or Duration (in seconds) inserted as a new column (4th field)

Output CSV File:  outputfile.csv

Label,StartDateTime,EndDateTime,Duration(Seconds),status
info01,20171231235000,20180101001000,1200,complete
info02,20180101103025,20180101104045,620,complete
info03,20180501062210,20180501063002,472,complete
info04,20180612193050,20180612193502,252,complete

Open in new window

0
I'm migrating my website to a secure server, and a certain cgi script is not being found when it is needed.  I've attached an excerpt from the server's error log, specifying what happened.  I don't know how to interpret this error log text, or how to remedy the issue.  The script which isn't being found is properly situated in the cgi-bin folder.Error-loading-SecureForm.txt
0
Hello,

A cgi script that was functioning properly when accessed via IP address, is currently not working when accessed via domain name (now that the nameservers have propagated.)
Instead it is producing a message to open or save the cgi file.

I have checked the scripts in cgi-bin and the permissions are all correct 755.

Thanks for your help.
0
Hi

I have 2 arrays and in one there is data that matches the x lines that are in the other array.

how can I delete the data that matches exactly from the other array.


@A = qw ( AA,
                   BB,
                   DD,
                   CC,
                   DD,
                   EE );

@B = qw( DD,
                  EE );




So I need to delete the DD,EE from @A. And in that order of DD,EE.


Thanks

Mike
0
Starting with Angular 5
LVL 12
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

I have some forms in some Perl CGI scripts, having an issue to get the values from the boxes that is checked.

In the example below, this will print all entries that is in an array with the boxes checked when displayed on the web page, what I need to do is have the user "uncheck" any values that is no longer needed then I can remove them as needed.

The problem is I'm not able to get the values of them or which ones has the checkbox unchecked. I've tried using the CGI "parma" to put them in an array but not working probably because I return the boxes to display in $Return.

 
if ($currentAdminType) {
    if (scalar(@{$userDetails{'admintype'}})) {
      # checkbox list to deselect item
      $Return.="Uncheck the appropriate checkbox to delete particular value<br />\n";
      foreach $Value (@{$userDetails{'admintype'}}) {
        $Return.="<input type=checkbox name=type checked value=\"$Value\" />".
                 "$Value<br />\n".
                 "<input type=hidden name=type value=\"$Value\" />\n";
      }
    } else {
      $Return.="Attribute is blank, so cannot be modified\n";
    }
}

Open in new window


The code will display the values with all having a checked box, to print to the web page I then pass $Return to a small sub that prints the page as needed.
Any help on how to get these values would be much appreciated.
0
I have a CVS file with thousands of lines and columns. I need to focus on column AM named or any column named  "EA-domain_list" in that row, I have several domains that are separated by commas in there.

Is there a way via perl, or some type of script that will feed this spreadsheet named master.csv in and take all the EA-domain_list that are in commas, and make new columns for each domain. Basically for example in summary

you look in the attached spreadsheet and look an AM you see mobi.sark.net, ne.sark.net,sark123.test.com I need what ever is in there to strip each domain into a new column like AS would be called EA-domain_list an in there would have ne.sark.net, the another one row AT would have sark123.test.com. Keep in mind some times there are 20 of  then in there. So then I would like to spit out a new file called adjusted_domain_list.csv

Also, I am sorry I didn't mention previously that I am using a Macbook
Example-Master.csv
0
Hi

I have a multidimensional hash slimier to bellow

How do I count hash sub keys?

Do I have to loop though the hash first?

my Actual data looks a bit like this
$HoH{$PolyNum}{$GroupNum}{$PointNum}={ Long=>$Long, Lat =>$Lat, Etc=>$ETC};

Open in new window


Due to data coruption I can't rely on PointNum I have to count them so I need to know how many points are in each GroupNum so I know if its a point (1), Line(2) , or Polygon(>2)  so I can process accordingly
I Know you can have more than 2 points on a line but this data does not

In the test bellow I get "Experimental keys on scalar is now forbidden at main.pl line 38."

use strict;
use warnings;

print "Hello World!\n";

my %hash = ( "barney" => "dinosaur", "elmo" => "monster");

# this works 
print  scalar keys %hash;
my %HoH;

$HoH{4}{ mash } = {
    captain  => "pierce",
    major    => "burns",
    corporal => "radar",
};

$HoH  {1} {flintstones} = {
        husband   => "fred",
        pal       => "barney",
    };
$HoH  {2} {jetsons}=  {
        husband   => "george",
        wife      => "jane",
        "his boy" => "elroy",  # Key quotes needed.
    };
$HoH  {3} {simpsons} = {
        husband   => "homer",
        wife      => "marge",
        kid       => "bart",
    };
  
  for my $num (sort keys %HoH){  
        for my $TV (sort keys %{$HoH{$num}} ){
print "\nNum keys $num " . scalar keys $HoH{$num}{$TV};
}

Open in new window

0
Hi all,
I have one Mysql 5.6 that has been installed in windows server 2012.  When I tried to run mysqldumpslow, the command not able to found the executable, how do I get this command added into Mysql in windows ? FYI I have installed active PERL  and in teh PERL Package Manager I can't find the package that contains this Mysqldumpslow.
0
Hi all,
I have a zonelist.txt file

In the file the contents are standard forward and reverse zones.  For example

db.test.com
db.sark.hello.com
db.177.6.206.in-addr.arpa

I would like a bash or a shell script that uses dig to transfer each of the contents into individual files based on the zone and put them into a folder called transfer.

For example if I do a list in that folder I would have individual flies. For example

db.test.com
db.sark.hello.com
db.177.6.206.in-addr.arpa

I use a Mac and I thought I could use
dig @100.100.100.100 -f zonelist.txt

But that just shows them on screen and not in individual files.

Lastly. Is any zone transfer is refused or failes and or for any reason it does not get that zone to make a file called errors.txt
0
The below code snippet  generates a extra "," at end of each line.
The first line prints out without the comma at end of line. The extra "," occurs from second line onward..

How to prevent the trailing , ?

      
my @allrows;
      my @columns;
      my $getfilename = join '', $partition_key,'.csv';
      my $rc  = $genextract->fetchrow_hashref() or $nodata = 1;
               my @row = @{$genextract ->{NAME}};

      foreach my $col (@row) {
          my $name = $col;
          $name =~ s/\s+//g;
          my $data = $rc->{$name};
          push @allrows, $data;
          push @columns, $name;
      }
      my $dumpdir = "$wkdir/RECgen_$getfilename";

      open (OUT, ">$dumpdir") or die(" - Could not open $dumpdir for export. $!");

      # List out all the columns/rows with header information and generating a csv outfile..
      $" = ",";
      print OUT "@columns\n";
      print OUT "@allrows\n";

      while (my $row = $genextract->fetchrow_hashref()) {
      
        foreach my $col (@columns) {
     
           print OUT $$row{$col},",";        
        }
        print OUT "\n";
      }
      close(OUT);

Open in new window



output given
10/01/2015,0784626443000,ACACIA,ACACIA_UNIT_1,BRYAN SOLAR LLC (RE),RN,80.743461
10/01/2015,0432268853000,AUSTPL,BOULDERPL_DENV2,LOWER COLORADO RIVER AUTHORITY (RE),OS,7.656099,
10/01/2015,930187393,AV,AV_DG1,TX LFG ENERGY LP (RE),RN,94.34616,
10/01/2015,0791659493000,BAFFIN,BAFFIN_UNIT1,BAFFIN WIND LLC (RE),RN,101.595611,
10/01/2015,0791659493000,BAFFIN,BAFFIN_UNIT2,BAFFIN WIND LLC (RE),RN,110.031439,

Open in new window



EXPECTED OUTPUT
10/01/2015,0784626443000,ACACIA,ACACIA_UNIT_1,BRYAN SOLAR LLC (RE),RN,80.743461
10/01/2015,0432268853000,AUSTPL,BOULDERPL_DENV2,LOWER COLORADO RIVER AUTHORITY (RE),OS,7.656099
10/01/2015,930187393,AV,AV_DG1,TX LFG ENERGY LP (RE),RN,94.34616
10/01/2015,0791659493000,BAFFIN,BAFFIN_UNIT1,BAFFIN WIND LLC (RE),RN,101.595611
10/01/2015,0791659493000,BAFFIN,BAFFIN_UNIT2,BAFFIN WIND LLC (RE),RN,110.031439

Open in new window

0

Perl

26K

Solutions

10K

Contributors

Perl is a high-level, general-purpose, interpreted, dynamic programming languages with over 25 years of development. Perl 5 runs on over 100 platforms from portables to mainframes and is suitable for both rapid prototyping and large-scale development projects.  Perl gained widespread popularity as a Common Gateway Interface (CGI) scripting language, in part due to its regular expression and string parsing abilities. In addition to CGI, Perl is used for graphics programming, system administration, network programming, finance, bioinformatics, and other applications.