How do I convert the processing instruction elements into normal XML element using Perl?
for example:
<?legalnoticestart?>
<?sourcenotestart?>
<para>Content para</para>
<?sourcenoteend?>
<?literallayoutstart?>
<?literallayoutend?>
<?literallayoutend?>
<?legalnoticeend?>
Required format:
<legalnotice>
<sourcenote>
<p>Content para</p>...
Do you guys have an idea
on how to search or list down .exe files on the server
I am currently using. (or maybe place it in an array)?
I will use this command in my Perl program. Assuming that my program
is also located on the said server. My OS is Linux - Ubuntu if that
even matters, just in case. working in CLI here. =)
...
Hi All,
I am doing one multiplication operation between two float variables. After that i need to check for numeric overflow, underflow and divide by zero errors if any.
How I can do this?
...
sub is_integer {
defined $_[0] && $_[0] =~ /^[+-]?\d+$/;
}
sub is_float {
defined $_[0] && $_[0] =~ /^[+-]?\d+(\.\d+)?$/;
}
For the code mentioned above, if we give input as 999999999999999999999999999999999999999999, it is giving output as not real number.
Can anyone help me in this regard why it is behaving like that?
I forg...
I am writting a Perl script to create pie graph using GD::Graph::pie with these arrays:
@Array1 = ("A", "B", "C", "D");
$array2 = [
['upto 100 values'],
['upto 100 values'],
['upto 100 values'],
['upto 100 values']
];
As per my understanding to get this done, I have to create an array with the references o...
Using a Perl or unix regex, how would I capture a word that is not a range of values. Here is what I am trying to achieve.
(\w:not('int','long'))
...
#!/usr/bin/perl
use strict;
use warnings;
my @a = qw/a b c/;
(@a) x= 3;
print join(", ", @a), "\n";
I would expect the code above to print "a, b, c, a, b, c, a, b, c\n", but instead it dies with the message:
Can't modify private array in repeat (x) at z.pl line 7, near "3;"
This seems odd because the X <op>= Y are documented as be...
I'm working on a Perl script that I was hoping to capture a string entered on the command line without having to enter the quotes (similiar to bash's "$@" ability). I'll be using this command quite a bit so I was hoping that this is possible. If I have:
if ($ARGV) {
I have to put the command line string in quotes. I'd rather do the...
I've got a Perl based FastCGI app that rarely goes down. However, when it does go down, the restart is not automatic. Restarting Apache manually always does the trick but that does address improving the uptime of the app.
I'm thinking of using a cron job in conjunction with a script that uses WWW::Mechanize to periodically check on the ...
I have an English language forum site written in perl that is continually bombarded with spam in Russian. Is there a way using Perl and regex to detect Russian text so I can block it?
...
I have a file like this:
my line - some words & text
oh lóok i've got some characters
I want to 'normalize' it and remove all the non-word characters. I want to end up with something like this:
mylinesomewordstext
ohlóokivegotsomecharacters
I'm using Linux on the command line at the moment, and I'm hoping there's some one-liner I c...
In perl, if I have a string $str and a pattern saved in $pat and I want to replace what is saved in $pat with 'nothing' only if $pat appears at the end of $str, how would the regular expression look like? I tried different versions of this - s/\$pat$//
That, and all variations( s/$pat$//, s/\${pat}$//, s/${pat}$//) are not working :|
...
I have a Windows DLL that I want to call from Perl. The prototype for the exported function is:
int __stdcall func(const char*, int, int, int, double, double, void**);
The last parameter returns a pointer to an object that is allocated in the function.
The perl code –
my $dll_path = "../stage/test_dll.dll";
my $dll_func = new Win32...
The documentation for ref() mentions several possible return values. I understand most of them, but not REF, IO, and LVALUE. How would I write Perl code to cause ref to return those values?
After reading the documentation on typeglobs and file handles, I came close for IO with this code:
open(INPUT, '<', 'foo.pl');
print ref(*INPUT{IO}...
I'm struggling with a classic legacy project: manual URL parsing and composition, manual routing etc. Knowing a bit of Catalyst I long for at least some of the concepts, for example proper (a.k.a. transparent) URL routing and parameter parsing for example. Ideally, I'd just use Catalyst and be done with it, but given it's a legacy projec...
How do I using a variable for the name of a table in a DBI query? I know how to use placeholders as part of the where clause, but how do I do this for the table name?
I would like to do something like this:
my $table_name='table1';
my $query = $dbh_cgi->prepare("select * from ?");
$query->execute($table_name);
So far, I end up get...
Here's my scenario:
I need to generate XML via Perl in which the schema is full of <xs:sequence> tags (i.e. the tags MUST appear in order). I don't have control over the schema (third party) and there have been so many problems whenever we add new CPAN modules (don't have a good way to propagate them to customers, etc) that we've basic...
I have this conditional in a perl script:
if ($lnFea =~ m/^(\d+) qid\:([^\s]+).*?\#docid = ([^\s]+) inc = ([^\s]+) prob = ([^\s]+)$/)
and the $lnFea represents this kind of line:
0 qid:7968 1:0.000000 2:0.000000 3:0.000000 4:0.000000 5:0.000000 6:0.000000 7:0.000000 8:0.000000 9:0.000000 10:0.000000 11:0.000000 12:0.000000 13:0.00000...
On the Windows command line and cygwin bash I can execute the following without problems:
cvs login
cvs -Q log -N -rVersion_01_00
A ruby script in the same directory contains the following:
`cvs login`;
`cvs -Q log -N -rVersion_01_00`;
When I execute the ruby script on the Windows command line I get the following error:
cvs log: w...
I have the following mostly ok code:
my $results = { data => [
map {
my $f = $_->TO_JSON;
$f->{display_field} = $_->display_field($q);
$f;
} $rs->all
]};
Only I'd rather it were more like the following:
my $results = { data => [
map {
%{$_->TO_JSON},
display_field => $_->display_field($q),
},...