perl

  • perl - Extract data using grep and sed 2017-11-12

    I'm using this code to get all titles from urls with http://something.txt: #!/usr/bin/perl -w $output = `cat source.html | grep -o '<a .*href=.*>' | grep -E 'txt' | sed -e 's/<a /\n<a /g' | sed -e 's/<a .*title="//' | cut -f1 -d '"

    Tags: perl, grep, html parsing, sed
  • Perl created files with future timestamps on FreeBSD 9.3 2017-11-03

    I just encountered some strange behavior with Perl 5.16.3 on FreeBSD 9.3-RELEASE-p3. We've got a cron job which runs every five minutes and generates some text status files. I just happened to list the contents of the output directory and saw that th

    Tags: perl, file io, freebsd
  • Combine an Array object with scalar value within a scalar? Perl 2017-09-19

    I'm trying to combine an item from an Array list with a scalar $range. Here's how I'm trying to do it. my $rowinc = 2; my $colarray = @collet[0]; my $range = $colarray $rowinc; chomp $range; $sheet->Range($range)->{Value} = $ir; shift @collet; $shee

    Tags: perl
  • Need to parse utf8 email with perl 2017-09-16

    I need to parse an email that appears to be encoded using utf-8 to pull out the subject and sender and pieces of the body. The header parts are no problem, but the body looks like this: LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t

    Tags: email, perl, utf 8, mime, mime types
  • (Perl) Use of uninitialized value $_ in map 2017-08-13

    I am trying to export query result to CSV file using this code : while (my $query_result = $query_select->fetchrow_arrayref) { print $fh join (',', map {s{"}{""}g; "=\"$_\"";} @$query_result), "\n"; } and ge

    Tags: perl, initialization, export to csv
  • perl list path of subdirectory using File::Find 2016-07-27

    How can I get all the paths of a subdirectory foo into an array in perl using File::Find abc\def\sdfg\gthrth\foo\ abc\def\fgfdg\foo\ abc\def\sdfgdsg\fgdfg\gfdgf\tytty\foo\ abc\def\foo\ I want to get the full paths of all subdirectories foo inside dir

    Tags: perl, file find
  • Perl reading from file into hash 2016-03-19

    I would like to read the contents of a file into a hash structure. The header of the file should be the key in the hash structure, as well as the values being the content listed below each column. The file that I am going to read from will look somet

    Tags: perl, hash
  • removing trailing words end with : from a string using perl 2016-01-10

    i have question on how to remove specific set of words that end with : in a string using perl. For instance, lunch_at_home: start at 1pm. I want to get only "start at 1 pm"after discarding "lunch_at_home:" note that lunch_at_home is ju

    Tags: perl
  • Why is there a + before the first left parenthesis following print in this Perl example? 2015-10-07

    This question already has an answer here: Why is 'print (52-80)*42' different than 'print 42*(52-80)' in Perl? 3 answers Recently I came across a statement like this print +( map { $_ + 1 } @$_ ), "\n" for @$array; # <- AoA I had not seen the

    Tags: perl
  • cvs annotate and standard error redirection 2015-03-13

    First, some background. I'm trying to use cvs annotate within a Perl script invoked from a ksh command line to find out who's using bad hex constants in their source code and dole out justice appropriately. I'd like to use stdout for this program str

    Tags: cvs, perl, ksh, stderr
  • Why I cannot read file line by line in perl script? 2015-03-10

    I have a perl script, which has to read a file line by line. line in the file: 0060|9592014|A001-9592014-0060|82769|NOVARTIS PHARMA SERVICES AG BASEL|51671|NOVARTIS AG|A+|SWITZERLAND|Guarantees Issued|12/31/2016|12/31/2016|0|0|0|0|0|0|0|0|0|29014.096

    Tags: perl
  • How to load a bunch of perl modules into a perl script 2015-02-25

    This is what I wish to do: In every script I make/develop I always call perl libraries and sub routines like: #! /directory/bin/perl system('source /directory/.cshrc&'); use Net::Domain qw(hostname hostfqdn hostdomain); use Time::Local; use Time:

    Tags: perl
  • Perl Module Net::DNS - calling "tsig" method on resolver object results in error 2015-02-16

    recently the linux-distribution i use (recent gentoo) upgraded the net-dns package to version 0.74 (from 0.66). from this time using TSIG on queries and updates does not work anymore. former i used: $resolver = Net::DNS::Resolver->new(...); $resol

    Tags: perl, dns, perl module, gentoo
  • How to use Perl to copy files from ssh server? 2015-02-11

    My requirement is find for specific files (filename.tup) on remote machine and based on that file copy other files from sub-directories (where the filename.tup file was found). here is my trial script. use File::Basename ; @tuppaths=`ssh $host "/usr/

    Tags: perl, ssh
  • perl script to find matching lines in two files 2015-02-04

    I have two files that look like (below) and want to find the fields from the first in the second file, but print every field of the second. #rs116801199 720381 #rs138295790 16057310 #rs131531 16870251 #rs131546 16872281 #rs140375 16873251 #rs131552 1

    Tags: perl, string matching
  • Input multiple files in perl 2015-02-02

    I have a perl script to do something like this : insert 10 file .txt (button) print each url to text area proces with tokenizer here's the script : sub Main_Menu{ # -------------------- # Create GUI interface # -------------------- my $mw = MainWindo

    Tags: perl, perl data structures, multiple files
  • How to assign variable value to constant in perl? 2015-01-29

    I have following code #!/usr/bin/perl -w use warnings; use constant ARRAY => "XCC320G"; print ARRAY; print "Enter ur choice\n"; chomp($choice = <STDIN>); ARRAY=>$choice; print ARRAY; Currently my code is with respect to constant. Now I wa

    Tags: perl
  • Is there a way to keep perl test data in memory between test runs? 2015-01-26

    When I run my test cases via prove, it takes about 20 - 25 seconds to load my test data before the first test runs. Is there a way I could have a separate, persistent process load the test data in memory, and prove just retrieve a copy instantly each

    Tags: testing, perl
  • file watching in a directory using perl 2015-01-19

    i need to watch files that fall under a directory.I have coded the below script in perl . but it is not doing what i want . whenever a file or files arrives , it has to do a movement . And then it has to keep watching files again. the script should b

    Tags: perl, file watcher
  • Perl how to provide full or absolute path to fcopy() function 2015-01-19

    I am new to perl and want to write a basic program to copy the entire directory contents to another directory. My first hurdle is that I need to give the absolute path for source and destination and I can't seem to get the following code to do that:

    Tags: perl, absolute path

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.882 (s). 7 q(s)