<rss version="2.0">
<channel>
<title>perl.beginners :: beginners@perl.org</title>
<link>http://www.nnseek.com/e/perl.beginners/</link>
<description>Posts for perl.beginners</description>
<lastBuildDate>Thu, 22 May 2008 09:39:09 PDT</lastBuildDate>
  <image>
    <title>http://www.nnseek.com/</title>
    <link>http://www.nnseek.com/</link>
    <url>http://www.nnseek.com/img/64.png</url>
    <width>64</width>
    <height>64</height>
    <description>NNSeek</description>
  </image>
<item>
	<title><![CDATA[hash]]></title>
	<guid>http://www.nnseek.com/e/perl.beginners/hash_69258486t.html</guid>
	<link>http://www.nnseek.com/e/perl.beginners/hash_69258486t.html</link>
	<description><![CDATA[
Hi all,

I have a flat file that contains a pid, us_size and euro_size. I want to create read in the file and create one hash for the us_size (%%US) and the other for the euro_size (%%EURO). Then i want to do a print statement if the pid value in the us_size hash is equal to pid value in the euro_size hash...maybe IF ($US{$pid} = $EURO{$pid}) {print statement...}. 

The part where i'm stuck on is how to assign the data into a hash and do the comparison, could one of you help me with the Perl's syntax or point in the right direction? 

Thanks much!


pid|us_size|euro_size
1|10|34
2|11|35
3|12|37
4|13|


       
<br>
    <table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="30">&nbsp;</td>
        <td>Posted In: <a href="http://www.nnseek.com/e/perl.beginners/">perl.beginners</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/perl.beginners/hash_69258486t.html"><b>7</b> Comments</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/perl.beginners/hash_69258486m.html">Reply</a></td>
      </tr></table><br>]]></description>
	<pubDate>Thu, 22 May 2008 09:39:09 PDT</pubDate>
</item>
<item>
	<title><![CDATA[same variable defined twice]]></title>
	<guid>http://www.nnseek.com/e/perl.beginners/same_variable_defined_twice_69201910t.html</guid>
	<link>http://www.nnseek.com/e/perl.beginners/same_variable_defined_twice_69201910t.html</link>
	<description><![CDATA[Hi,

I've tried the following script and it works fine:

use strict;
my $text = 1;
my $text = 2;
print $text;

Shouldn't perl disallow defining the $text variable a second time in the same script if using "use strict"?

Thank you.

Octavian
<br>
    <table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="30">&nbsp;</td>
        <td>Posted In: <a href="http://www.nnseek.com/e/perl.beginners/">perl.beginners</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/perl.beginners/same_variable_defined_twice_69201910t.html"><b>2</b> Comments</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/perl.beginners/same_variable_defined_twice_69201910m.html">Reply</a></td>
      </tr></table><br>]]></description>
	<pubDate>Thu, 22 May 2008 05:57:58 PDT</pubDate>
</item>
<item>
	<title><![CDATA[Comparing file contents, the perl way]]></title>
	<guid>http://www.nnseek.com/e/perl.beginners/comparing_file_contents_the_perl_way_69180406t.html</guid>
	<link>http://www.nnseek.com/e/perl.beginners/comparing_file_contents_the_perl_way_69180406t.html</link>
	<description><![CDATA[Good morning,

I have 2 files which contains some IDs. Basically I want to search ID
in the file A which is missing on the file B.

This program is ugly, but its work :-)
------------
use strict;

my $target_file = "B.txt";
while(<>) {
   chomp;
   my $res = `grep $_ $target_file`;
   print "$_ is missing\n" if ! $res;
}
------------

I'm trying to found another solutions which more perlish and efficient.
So far im relying that ID should be same digits on the both file,
because "123" will match "1234" :-(

File contents is around 20k - 30k lines, so i must consider the
performance and memory usage also.

A.txt
-----
12345
56789
32134
62134
42134
52134
12234

B.txt
-----
12234
42134
82134
32134


Thanks.

--budhi<br>
    <table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="30">&nbsp;</td>
        <td>Posted In: <a href="http://www.nnseek.com/e/perl.beginners/">perl.beginners</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/perl.beginners/comparing_file_contents_the_perl_way_69180406t.html"><b>3</b> Comments</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/perl.beginners/comparing_file_contents_the_perl_way_69180406m.html">Reply</a></td>
      </tr></table><br>]]></description>
	<pubDate>Wed, 21 May 2008 19:40:52 PDT</pubDate>
</item>
<item>
	<title><![CDATA[RE: what is ^M at the end of a line?]]></title>
	<guid>http://www.nnseek.com/e/perl.beginners/what_is_m_at_the_end_of_a_line_69134070t.html</guid>
	<link>http://www.nnseek.com/e/perl.beginners/what_is_m_at_the_end_of_a_line_69134070t.html</link>
	<description><![CDATA[If your trying to do this on a unix based system 

^M is equivalent to \r\n so you can get rid of \r I believe. 

-----Original Message-----
From: Remy Guo [mailto:rollingstars@<a href="http://gmail.com" rel="nofollow" class="url" target="_blank">gmail.com</a>] 
Sent: 21 May 2008 15:20
To: Rob Coops
Cc: Perl Beginners
Subject: Re: what is ^M at the end of a line?

it's really interesting... then how can i match that ^M using regex?
i've tried "chomp" when reading each line but it doesn't work...

2008/5/21 Rob Coops <rcoops@<a href="http://gmail.com" rel="nofollow" class="url" target="_blank">gmail.com</a>>:

> That ^M is a line feed, or well the windows version of a line feed.
>
> There are several different ways in which to write a line feed and of 
> course to make our lives better *nix, Dos/Windows and Mac all have 
> their own way of writting them.
>
> So Jeff's suggestion relies on a little application that simply finds 
> ad relapces all the dos/windows ways of doing things like line feeds 
> and replaces them with the unix version of the same.
>
> If you feel like doing this in perl a simple regex will do the trick, 
> at least for the line feeds, but there is more windows fun to be had, 
> like the way MS Word replaces ceretain characters like " ' - and even 
> ... with a special charatcer because they are estetacly more pleasing 
> to the reader of the document. I am sure there are more examples and 
> dos2unix covers them all.
>
> So if it is a single file and only a one of then dos2unix is the 
> easiest way, if you want to do it in perl then you will most likely 
> have to use a regex because not all moachines will have the dos2unix 
> applicaiton available.
>
> Regards,
>
> Rob Coops
>
>   On Wed, May 21, 2008 at 10:45 AM, Remy Guo <rollingstars@<a href="http://gmail.com" rel="nofollow" class="url" target="_blank">gmail.com</a>>
> wrote:
>
>> hi all,
>> i have a text processing script that can work with a file but cannot 
>> work with another file that has the same content.
>> as i compared the 2 files, i found the file that cannot work has a 
>> "^M" at the end of each line. what is this? is this what made it not
work?
>> by the way, i'm under unix.
>> thanks....
>>
>> -Remy
>>
>
>


This e-mail is from the PA Group.  For more information, see
<a href="http://www.thepagroup.com" rel="nofollow" class="url" target="_blank">www.thepagroup.com</a>.

This e-mail may contain confidential information.  Only the addressee is
permitted to read, copy, distribute or otherwise use this email or any
attachments.  If you have received it in error, please contact the sender
immediately.  Any opinion expressed in this e-mail is personal to the sender
and may not reflect the opinion of the PA Group.

Any e-mail reply to this address may be subject to interception or
monitoring for operational reasons or for lawful business practices.



<br>
    <table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="30">&nbsp;</td>
        <td>Posted In: <a href="http://www.nnseek.com/e/perl.beginners/">perl.beginners</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/perl.beginners/what_is_m_at_the_end_of_a_line_69134070t.html">no comments</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/perl.beginners/what_is_m_at_the_end_of_a_line_69134070m.html">Reply</a></td>
      </tr></table><br>]]></description>
	<pubDate>Wed, 21 May 2008 07:22:46 PDT</pubDate>
</item>
<item>
	<title><![CDATA[DBI question]]></title>
	<guid>http://www.nnseek.com/e/perl.beginners/dbi_question_69130486t.html</guid>
	<link>http://www.nnseek.com/e/perl.beginners/dbi_question_69130486t.html</link>
	<description><![CDATA[

I have a program that will run literally for days and days.  It monitors
logs by file tail.  Problem is that I think the DBI is causing problems.
It is constantly connecting and reconnecting to DB2 for every
transaction.

What I would like to do is block the subroutine and check the DBI
connection for being 'valid' still and then if it is not valid,
reconnect, sleep then try again for N times then give up entirely
issuing message to support.

I saw mention of a state variable but this not on the connection.   Any
help to make this work would be appreciated.

Thanks
Ken

<br>
    <table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="30">&nbsp;</td>
        <td>Posted In: <a href="http://www.nnseek.com/e/perl.beginners/">perl.beginners</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/perl.beginners/dbi_question_69130486t.html"><b>2</b> Comments</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/perl.beginners/dbi_question_69130486m.html">Reply</a></td>
      </tr></table><br>]]></description>
	<pubDate>Wed, 21 May 2008 06:53:19 PDT</pubDate>
</item>
<item>
	<title><![CDATA[How to chdir using SFTP or SSH on Win32]]></title>
	<guid>http://www.nnseek.com/e/perl.beginners/how_to_chdir_using_sftp_or_ssh_on_win32_69130742t.html</guid>
	<link>http://www.nnseek.com/e/perl.beginners/how_to_chdir_using_sftp_or_ssh_on_win32_69130742t.html</link>
	<description><![CDATA[
Hi list,

I asked this question a few days ago on the perl-win32-users list but still
need some help. It seems what I need may not be possible.

I have a perl (5.6) SFTP client (Net::SFTP) that gets and puts files using
either a full or relative path with the filename something like this:

$sftp->get( $remotename, $localname ); # where $remotename =
'/Home/OUT/myfile.txt'

But I have a remote system with a custom server app that rejects the path
and requires a chdir to the correct file location. To fetch a file I need to
do something like this:

$sftp->chdir( $path );   #cd to the OUT folder
$sftp->get( $shortname, $localname);   # get the file using only the file
name

I see no way to do $sftp->chdir. Please advise if something similar is
possible. I have tried many combinations of commands using SSH such as
$ssh->cmd( 'cd $path' ) with no joy. $ssh->cmd() always seems to hang. TIA.

Sturdy



<br>
    <table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="30">&nbsp;</td>
        <td>Posted In: <a href="http://www.nnseek.com/e/perl.beginners/">perl.beginners</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/perl.beginners/how_to_chdir_using_sftp_or_ssh_on_win32_69130742t.html"><b>5</b> Comments</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/perl.beginners/how_to_chdir_using_sftp_or_ssh_on_win32_69130742m.html">Reply</a></td>
      </tr></table><br>]]></description>
	<pubDate>Wed, 21 May 2008 06:46:16 PDT</pubDate>
</item>
<item>
	<title><![CDATA[Sending special chars in email header]]></title>
	<guid>http://www.nnseek.com/e/perl.beginners/sending_special_chars_in_email_header_69122550t.html</guid>
	<link>http://www.nnseek.com/e/perl.beginners/sending_special_chars_in_email_header_69122550t.html</link>
	<description><![CDATA[Hi,

I've tried to send some UTF-8 chars in the "To" and "From" fields in the header of a message, using Mail::Sender, and I also tried more combinations for setting the encoding and charset, but the chars don't appear correctly in the message.

It should be possible to use those special chars like "Râşniţă" because I was able to send a correct message with Outlook Express, so I must have been doing something wrong.

Can anyone give some hints about how to do that?

Thank you.

Octavian
<br>
    <table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="30">&nbsp;</td>
        <td>Posted In: <a href="http://www.nnseek.com/e/perl.beginners/">perl.beginners</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/perl.beginners/sending_special_chars_in_email_header_69122550t.html"><b>4</b> Comments</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/perl.beginners/sending_special_chars_in_email_header_69122550m.html">Reply</a></td>
      </tr></table><br>]]></description>
	<pubDate>Wed, 21 May 2008 04:58:06 PDT</pubDate>
</item>
<item>
	<title><![CDATA[what is ^M at the end of a line?]]></title>
	<guid>http://www.nnseek.com/e/perl.beginners/what_is_m_at_the_end_of_a_line_69110774t.html</guid>
	<link>http://www.nnseek.com/e/perl.beginners/what_is_m_at_the_end_of_a_line_69110774t.html</link>
	<description><![CDATA[
hi all,
i have a text processing script that can work with a file but cannot work
with another file that has the same content.
as i compared the 2 files, i found the file that cannot work has a "^M" at
the end of each line. what is this? is this what made it not work?
by the way, i'm under unix.
thanks....

-Remy

<br>
    <table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="30">&nbsp;</td>
        <td>Posted In: <a href="http://www.nnseek.com/e/perl.beginners/">perl.beginners</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/perl.beginners/what_is_m_at_the_end_of_a_line_69110774t.html"><b>8</b> Comments</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/perl.beginners/what_is_m_at_the_end_of_a_line_69110774m.html">Reply</a></td>
      </tr></table><br>]]></description>
	<pubDate>Wed, 21 May 2008 01:45:17 PDT</pubDate>
</item>
<item>
	<title><![CDATA[Re: No such file or directory]]></title>
	<guid>http://www.nnseek.com/e/perl.beginners/no_such_file_or_directory_69109494t.html</guid>
	<link>http://www.nnseek.com/e/perl.beginners/no_such_file_or_directory_69109494t.html</link>
	<description><![CDATA[



----- Original Message ----
From: Jeff Peng <peng.kyo@<a href="http://gmail.com" rel="nofollow" class="url" target="_blank">gmail.com</a>>
To: Perl Beginners <beginners@<a href="http://perl.org" rel="nofollow" class="url" target="_blank">perl.org</a>>
Sent: Wednesday, May 21, 2008 15:53:00
Subject: Re: No such file or directory

> open(RULES, 'rule.pl')

please use full path if you don't know where you are exactly.

On Wed, May 21, 2008 at 3:45 PM, anthony brooke <esia168@<a href="http://yahoo.com" rel="nofollow" class="url" target="_blank">yahoo.com</a>> wrote:


-- 
Jeff Peng - Peng.Kyo@<a href="http://Gmail.com" rel="nofollow" class="url" target="_blank">Gmail.com</a>
Professional Squid supports in China
<a href="http://www.ChinaSquid.com" rel="nofollow" class="url" target="_blank">http://www.ChinaSquid.com</a>/

-- 
To unsubscribe, e-mail: beginners-unsubscribe@<a href="http://perl.org" rel="nofollow" class="url" target="_blank">perl.org</a>
For additional commands, e-mail: beginners-help@<a href="http://perl.org" rel="nofollow" class="url" target="_blank">perl.org</a>
<a href="http://learn.perl.org" rel="nofollow" class="url" target="_blank">http://learn.perl.org</a>/


The problem is I am using mod_perl, wherever I am it always show "/" as the current working directory. I got to post the problem to 

Send instant messages to your online friends <a href="http://uk.messenger.yahoo.com" rel="nofollow" class="url" target="_blank">http://uk.messenger.yahoo.com</a> 
<br>
    <table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="30">&nbsp;</td>
        <td>Posted In: <a href="http://www.nnseek.com/e/perl.beginners/">perl.beginners</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/perl.beginners/no_such_file_or_directory_69109494t.html">no comments</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/perl.beginners/no_such_file_or_directory_69109494m.html">Reply</a></td>
      </tr></table><br>]]></description>
	<pubDate>Wed, 21 May 2008 01:14:14 PDT</pubDate>
</item>
<item>
	<title><![CDATA[Re: No such file or directory]]></title>
	<guid>http://www.nnseek.com/e/perl.beginners/no_such_file_or_directory_69108726t.html</guid>
	<link>http://www.nnseek.com/e/perl.beginners/no_such_file_or_directory_69108726t.html</link>
	<description><![CDATA[





anthony brooke wrote:
> Hello, I know that this is a very common problem, but I am very sure that  the file exist in that directory, also its permission is -rwxrwxrwx , why does it give such an error ? What are the other potential problems that cause this ? Thanks
>
> Send instant messages to your online friends <a href="http://uk.messenger.yahoo.com" rel="nofollow" class="url" target="_blank">http://uk.messenger.yahoo.com</a> 
>  
Anthony
It would help  if you could post a sample of you script and give the 
actuall error.


Also I am using mod_perl, is it because of that make my cwd become the top directory "/" ? Thanks

Send instant messages to your online friends <a href="http://uk.messenger.yahoo.com" rel="nofollow" class="url" target="_blank">http://uk.messenger.yahoo.com</a> 
<br>
    <table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="30">&nbsp;</td>
        <td>Posted In: <a href="http://www.nnseek.com/e/perl.beginners/">perl.beginners</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/perl.beginners/no_such_file_or_directory_69108726t.html"><b>1</b> Comment</a></td>
        <td width="20">&nbsp;</td>
        <td><a href="http://www.nnseek.com/e/perl.beginners/no_such_file_or_directory_69108726m.html">Reply</a></td>
      </tr></table><br>]]></description>
	<pubDate>Wed, 21 May 2008 00:45:30 PDT</pubDate>
</item>
</channel>
</rss>