How do you extract data using regex from excel sheet in Perl
How do you extract the data using regex in a workbook. For example, I want to extract a set of strings that match a pattern in the workbook which contains many sheets. ...
How do you extract the data using regex in a workbook. For example, I want to extract a set of strings that match a pattern in the workbook which contains many sheets. ...
Why do Perl variables need to start with different characters? Scalar variables start with $ Hashes start with % Arrays start with @ Why are they like this? ...
In the following code upto what scope the anonymous array referred by $ref is available. mod1.pm: package mod1; sub do_something{ ..... my $array_ref = ["elemnt1","elmnt2"] ; return $array_ref ; } 1; file.pl use mod1; my $ref = mod1::do_something() ; print "$ref->[0] $ref->[1] " ; #works ...
I need to find the total timings for the execution of a program over different inputs. The program reads some data and writes it into another file. The values of the data value and the size of the data are different every time. I want to find how long it will take in general for all size of data. Is the algorithm for finding this base...
This is ok: $foo++ if $condition; And this is ok: $foo++ for (1..10); But this isn't: $foo++ if $condition for (1..10); I find the latter quite readable if things aren't complicated, and it fits on one line! Is there a way to do this or should I move on with my life? ...
I have written a set of classes and interfaces that are implemented in Moose also using roles. What I am having trouble understanding is the exact differences in both usage and implementation of Moose traits vs. roles. The Moose documentation states: It is important to understand that roles and traits are the same thing. A role can ...
Hi, I wanted to be able to do this in Perl (the code below is Python lol) try: import Module except: print "You need module Module to run this program." Does anyone have any idea how to? ...
I am mulling over a best practice for passing hash references for return data to/from functions. On the one hand it seems intuitive to pass only input values to a function and have only return output variables. However in Perl, passing hashes can only be done by reference so it is a bit messy and would seem more of an opportunity to ...
I'm using cURL to get the XML file for my Twitter friend's timeline. (API here.) Currently (though I'd be open for more suggestions) I am using Perl to parse the XML. This is my first time using Perl and I really don't know what I am doing. Currently this is my code: #!/usr/bin/perl # use module use XML::Simple; use Data::Dumper; # ...
I'm writing a perl module called perl5i. Its aim is to fix a swath of common Perl problems in one module (using lots of other modules). To invoke it on the command line for one liners you'd write: perl -Mperl5i -e 'say "Hello"' I think that's too wordy so I'd like to supply a perl5i wrapper so you can write perl5i -e 'say "Hello"'. I...
I am trying to use Class::DBI with Catalyst::Plugin::Authentication::Store::DBIC. The example given on CPAN does not work with Class::DBI. For example, the config is incorrect: role_class => 'DB::Role' has to be replaced by role_class => 'MyApp::Model::DB::Role' I got Authentication working using plain DBI, but I would rather use Class...
I need to extract certain Abbreviations from a file such as ABS,TVS,and PERL. Any abbreviations which are in uppercase letters. I'd preferably like to do this with a regular expression. Any help is appreciated. ...
Are there any functions are available for converting all newlines in a string to spaces? For example: $a = "dflsdgjsdg dsfsd gf sgd g sdg sdf gsd"; The result is am looking for is: $a = "dflsdgjsdg dsfsd gf sgd g sdg sdf gsd" ...
Hello, I'm trying to read data from SQL Server database using Perl and the DBI module. My intention is to read the data and print it into a text file (comma separated). When I do this, I get the result like this: var1,var2,var3 40406,20 ,783 50230,78 ,680 50230,78 ,680 50230,78 ,680 50230,78 ,680 So there is a whitespace between the ...
I just want to find the way of disable the sort operation in XML::Simple For example: #!/usr/bin/perl use strict; use warnings; use XML::Simple; my %my_xml = ( NAME => [ 'test' ], EMAIL => [ '[email protected]' ], ID => 12, ); my $xs = XML::Simple->new; print $xs->XMLout(\%my_xml, RootName => "datas", NoSort => 1); ...
Here's an interesting problem. Is it possible to split a string on the last matching regex only? Consider the following list of column headings from my data file (which read along the same line, being tab-separated): Frequency Min Frequency Avg Frequency Max Voltage L1 Min Voltage L1 Avg Voltage L1 Max Active Power L1 Min Active Power ...
In Perl 5.10, how do I create and access a hash with scalar keys whose values are arrays? #Doing this does not work properly. %someHash= ("0xfff" => ('Blue', 'Red', 'Yellow')); @arr = @fileContents{"0xfff"}; print @arr; When I print the array, the only thing that prints is "ARRAY('randmemAddr')". When I do a foreach loop on @arr, only...
I am getting this error in error_log one of my Perl CGI application. I am pretty sure I haven't changed my script at all and all of a sudden i have started getting this error. This is what I see in error_log: [Wed Jul 8 15:18:20 2009] [warn] FastCGI: server "/local/web/test/cgi-bin/test.pl" (pid 17033) terminated by calling exit ...
Hello, This Perl binary regex found at http://www.w3.org/International/questions/qa-forms-utf-8.en.php matches UTF-8 documents without the UTF-8 BOM header: $field =~ m/\A( [\x09\x0A\x0D\x20-\x7E] # ASCII | [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte | \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs ...
I am trying to download an MP3 file from an AGI script written in Perl, however the file does not get downloaded. The strange thing is that if I try to download the same file from a plain Perl script it gets downloaded. Here's my AGI code: use Asterisk::AGI; $AGI = new Asterisk::AGI; my %input = $AGI->ReadParse(); $AGI->answer(); s...