I am using Text::CSV to parse a csv file. Not all lines can be parsed, because of some bad characters.
The Text::CSV documentation says:
Allowable characters within a CSV field include 0x09 (tab) and the inclusive range of 0x20 (space) through 0x7E (tilde).
How can I filter out as easy as possible any not-allowed characters?
...
Possible Duplicate:
What are the common workarounds for multi-line comments in Perl?
Hi All,
I am new to Perl and am wondering how to do a multi-line comment.
...
I'm trying to get the tags that occur immediately after a particular div tag. For e.g., I have html code
<div id="example">
<h2>Example</h2>
<p>Hello !World</p>
</div>
I'm doing the following,
while ( $tag = $stream->get_tag('div') ) {
if( $tag->[1]{id} eq 'Example' ) {
$tag = $stream->get_tag;
$tag = $s...
I was always wondering about this, but never really looked thoroughly into it.
The situation is like this: I have a relatively large set of data instances. Each instance has the same set or properties, e.g:
# a child instance
name
age
height
weight
hair_color
favorite_color
list_of_hobbies
Usually I would represent a child as a hash ...
Hi to all,
due to Internet communication i could have two (or more) ASCII files in RINEX format (GPS ASCII format) of the same data period, which i would like to merge to one file.
Each data set (epoch) contain more then one line (in this example 19 lines). I would like to merge those files, where it could be that they in some parts ov...
I need to write Arabic words as labels inside a .pm file. It is not working for me. I tried ASCII letters and they worked. Is there a better way to do so?
I tried something like:
<span dir="rtl" lang="ar">عربي</span>
...
$ cat flaglist.log
flag1
flag2
flag3
flag4
$
Perl code
my $infile = "flaglist.log";
open my $fpi, '<', $infile or die "$!";
while (<$fpi>) {
chomp;
if ($ENV{$_}) { # something wrong here
func($_);
}
else {
print "oops\n";
}
}
$ perl code.pl
oops
oops
oops
oops
$
All the four f...
$ cat names
projectname_flag_jantemp
projectname_flag_febtemp
projectname_flag_marchtemp
projectname_flag_mondaytemp
$
Perl code:
my $infile = "names";
open my $fpi, '<', $infile or die "$!";
while (<$fpi>) {
my $temp = # what should come here? #
func($temp);
}
I want temp to have
jan
feb
march
monday
respectively.
The p...
Initially, I was looking for a fast way to access a hash ref element (with a default value if no value is available).
So I tried the following :
use strict;
use warnings;
use DateTime;
my $hashref = { };
for (0..249) {
my $lIdx = $_ * 2;
$hashref->{"MYKEY$lIdx"} = "MYVAL$lIdx";
}
sub WithVariable{
my $result = $hashref->{"MYKE...
I'm trying to fix an intermittent bug in git-svn. The problem is happening in Windows XP only, with both Cygwin git (perl v5.10.1) and msysGit (perl v5.8.8).
With any operation that involves a fetch, I'm able to get partway through and then the operation dies with a message similar to
Couldn't open .git/svn/refs/remotes/trunk/.rev_...
Possible Duplicate:
Is there SQL parameter binding for arrays?
I was wondering if there is anyway to use bind_param with SQL IN statements. According to perl documentation bind_param_array cannot be used as well. Has anyone come across the same situation?
http://search.cpan.org/perldoc?DBI#bind_param_array
...
I know this regex divides a text into sentences. Can someone help me understand how?
/(?<!\..)([\?\!\.])\s(?!.\.)/
...
I have a string of packed values which was created sequentially using something like:
while (...) {
...
$packed .= pack( 'L', $val );
}
In another program, after I load $packed, I wish to find out how many values were actually packed. I know how to do that after unpacking:
my @vals = unpack( 'L*', $packed );
print scalar(@vals);
...
This is going to seem extremely trivial, but it just doesn't make any sense to me.
I have the following snippit of code:
foreach $i (@inputtext)
{
@line = split(/\|/, $i);
foreach $j (@line)
{
print "$j, ";
}
}
The input is three of the following lines, identical:
98465895|No idea what goes here|123 anywhere lane|city|ST...
I'm working on a tool that needs to send IRC messages to an internal IRC channel. This isn't a constantly running program, but rather a tool that will be invoked occasionally and needs to be able to notify the channel with a couple of messages when it's invoked.
I looked at Net::IRC, but it's been dead since 2004. So I looked at the alt...
In Unix, I have a process that I want to run using nohup. However this process will at some point wait at a prompt where I have to enter yes or no for it to continue. So far, in Unix I have been doing the following
nohup myprocess <<EOF
y
EOF
So I start the process 'myprocess' using nohup and pipe in a file with 'y' then close the fil...
I want to make a program that communicates with http://www.md5crack.com/crackmd5.php. My goal is to send the site a hash (md5) and hopefully the site will be able to crack it. After, I would like to display the plaintext of the hash. My problem is sending the data to the site. I looked up articles about using LWP however I am still lost....
I want to be able to set a system environment variable in Perl and I wrote the following script (inspired from this idea) to accomplish this:
use Win32;
use Win32::API;
use Win32::OLE qw( in );
my $machine = ".";
my $WMIServices = Win32::OLE->GetObject ( "winmgmts:{impersonationLevel=impersonate,(security)}//$machine/root/cimv2" ) || d...
I remember having used the variable $OSNAME in linux.
Currently I'm working on a project on Solaris where I need to get the OS name and that variable is not working on Solaris.
Even a simple one line program does not work:
print "OS is $OSNAME\n";
it prints
OS is
Please help.
...
I'm an experienced UNIX programmer.
Now I want to develop a simple Windows application; the programming part would be very easy with almost any tool (it might be C, Perl, or something else).
However, I wonder what tool to use in order to have some simple GUI around it?
I've read a little about Perl/TK, but understood that it's too old, ...