Using / of unix and \ of windows for copying files

2009-01-18 Thread Sarsamkar, Paryushan
Hi All,

 

I want to write a single Perl script to copy some files from one machine
to another. Those can be windows or unix. Is that possible to have one
script to do it?

 

The script that I have written is as follows which do the job for
windows to windows. The problem here is if user says target as
/usr/abc/pqr then it will fail as it will try to copy it to location as
"/usr/abc/pqr\codebase\iba.properties".

 

How can I work with / and \ here?

 

---code-

 

#!/usr/bin/perl

use strict;

use warnings;

use File::Copy;

 

my $Source = q{D:\Folder1\Folder2};

my $Target = q{D:\FolderA\FolderB};

 

copy("$Source\\codebase\\iba.properties",
"$Target\\codebase\\iba.properties") 

  or die "* ATTENTION Aborting the
script as failed to copy : $!";

 

end-

 

Thanks,

Paryushan

 



Perl-R bridge

2009-01-18 Thread ANJAN PURKAYASTHA
Hi,
I'm planning to access R from my perl scripts.
The only noteworthy bridge seems to be
Statistics-R-0.03.
Would anyone like to share their experience with this Perl-R bridge?
I'd like to install it in a Mac OS X.
Suggestions on alternate solutions will be appreciated.
Thanks in advance,
Anjan


-- 
=
anjan purkayastha, phd
bioinformatics analyst
whitehead institute for biomedical research
nine cambridge center
cambridge, ma 02142

purkayas [at] wi [dot] mit [dot] edu
703.740.6939


Re: Updating Perl 5.8.8 to 5.10 under MacOSX and Eclipse EPIC

2009-01-18 Thread Steven Sankaran
Hm. I have spent the last hour or so attempting to get this to work,
but I cannot seem to get Perl to update. I have located the 5.10
directory under /usr/local/ActiveState-5.10 but I cannot get Eclipse
to recognize it. I even tried Eclipse and EasyEclipse. Does anyone
have any other IDE suggestions for Mac OSX? Perhaps something a little
more user friendly. I feel so discouraged, I can't even get it to
point to the interpreter, and all I can say is print 'hello world'
haha.

Thanks guys,
Steven

On Sun, Jan 18, 2009 at 5:09 PM, Telemachus  wrote:
> On Sun Jan 18 2009 @  4:35, Steven Sankaran wrote:
>> Hello,
>> So, I was going through a tutorial and I realized that my Eclipse
>> install is using an older version of Perl that does not recognize the
>> "say" command. I have attempted updating Perl to 5.10 using the
>> ActivePerl-5.10.pkg ,however, as far as I can tell, that doesn't seem
>> to be working. I am currently running the latest version of Mac OSX,
>> which is currently running 5.8.8. How do I update this to 5.10, so
>> that I may use the "say" command? I run the installer, but it does not
>> seem to be helping. Is there something I am missing?
>>
>> Any help would be greatly appreciated,
>> Thank you.
>>
>> -Steven
>
> Your default perl lives at /usr/bin/perl and as I recall, ActiveState's
> package puts the new one in /opt. So the problem is probably that Eclipse
> is not "seeing" the newly installed 5.10. I don't know how to set such a
> preference in Eclipse, but this may help point you in the right direction.
>
> --
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
>
>
>

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: What does MakeFile do?

2009-01-18 Thread Owen
> Which is obviously a real beginner question. I have googled around,
> but all the info I have found assumes you have access to the server.
>
> My sites are shared hosting accounts located at Earthlink, Verio,
> GoDaddy, etc. I have used a number of scripts which I can use just by
> ftp uploading text files and changing permissions. Now I have a script
> (a module actually) I would like to use which arrives as a package
> that needs to be installed with a MakeFile.PL
>
> First, how can I install this module?
>
> Or should the .pm file located in the package work just by uploading?
>
> But more generally, what does make do?
>
> Is there a way to do it locally (on MacOSX) and then upload? Or is the
> installation server specific? (I did try it via Terminal, but it threw
> an error and did not complete.)


When you download a package, the first step is to unarchive it.

The second step is to read the INSTALL which will tell you what to do

What is the module?

The reason for this is that some modules are architecture dependant
and must be compiled against your 'server'

If you get an error message, keep it and if you don't understand it,
post it verbatim so others may help you

Owen


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




What does MakeFile do?

2009-01-18 Thread Lewis Kirk
Which is obviously a real beginner question. I have googled around, but all the 
info I have found assumes you have access to the server.

My sites are shared hosting accounts located at Earthlink, Verio, GoDaddy, etc. 
I have used a number of scripts which I can use just by ftp uploading text 
files and changing permissions. Now I have a script (a module actually) I would 
like to use which arrives as a package that needs to be installed with a 
MakeFile.PL

First, how can I install this module?

Or should the .pm file located in the package work just by uploading?

But more generally, what does make do?

Is there a way to do it locally (on MacOSX) and then upload? Or is the 
installation server specific? (I did try it via Terminal, but it threw an error 
and did not complete.)
-- 
Lewis Kirk
www.dmzgraphics.com
803-787-3450

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Newbie question about variables, arrays and where they all go

2009-01-18 Thread Telemachus
From: Telemachus 
Date: Sun, 18 Jan 2009 20:17:27 -0500
To: beginners@perl.org
Subject: Re: Newbie question about variables, arrays and where they all go

On Sun Jan 18 2009 @  7:54, Telemachus wrote:
> The arguments to a subroutine go into the @_ array. The @numbers array is
> empty until you load it up in the foreach loop. 

Edit: I should have said that the @numbers array is empty before the *first*
run. Since it's persistent, after that it already contains all the items from
previous calls. So on a second call, it already has 5 and 6. (I should also
consider spelling 'understand' with a d.)

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Updating Perl 5.8.8 to 5.10 under MacOSX and Eclipse EPIC

2009-01-18 Thread Telemachus
On Sun Jan 18 2009 @  4:35, Steven Sankaran wrote:
> Hello,
> So, I was going through a tutorial and I realized that my Eclipse
> install is using an older version of Perl that does not recognize the
> "say" command. I have attempted updating Perl to 5.10 using the
> ActivePerl-5.10.pkg ,however, as far as I can tell, that doesn't seem
> to be working. I am currently running the latest version of Mac OSX,
> which is currently running 5.8.8. How do I update this to 5.10, so
> that I may use the "say" command? I run the installer, but it does not
> seem to be helping. Is there something I am missing?
> 
> Any help would be greatly appreciated,
> Thank you.
> 
> -Steven

Your default perl lives at /usr/bin/perl and as I recall, ActiveState's
package puts the new one in /opt. So the problem is probably that Eclipse
is not "seeing" the newly installed 5.10. I don't know how to set such a
preference in Eclipse, but this may help point you in the right direction.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Newbie question about variables, arrays and where they all go

2009-01-18 Thread Telemachus
On Sun Jan 18 2009 @ 10:59, dolphin_sonar wrote:
>1 # When calling 'running_sum(5, 6);' the variable 'state @numbers'
> receives those two
>2 # parameters, (5 and 6), right? Then, the @numbers array also
> copies/stores (5 and 6)
>3 # into the special '( @_ )' variable as well, right? Also, line
> 13 pushes '$number' into
>4 # the '@numbers' array each time through the foreach loop,
> right?

Maybe I'm not understaning what you mean, but I think you're confused. The
arguments to a subroutine go into the @_ array. The @numbers array is
empty until you load it up in the foreach loop. Having 5 and 6 as arguments
does not automatically put those items into @numbers, nor does @numbers
copy anything into @_.

Also, I understand that you may just be testing out persistent variables in
5.10, but this program is confusing.

Consider what happens if you call running sum a second time (say as
running_sum( 2, 7 );) If I add that call, here's my output:

telemachus ~ $ perl sum
The sum of (5 6) is 11
The sum of (5 6 2 7) is 31

That appears to say that perl has added 5, 6, 2, and 7 up to 31. What
actually happened was that you added 5, 6, 2 and 7 (20) to 11 (the sum from
the previous call to running_sum - which was saved). To put this another way
around: maybe you want to keep a running sum, but the print statement in the
subroutine is very confusing.

Hope this helps, T

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Updating Perl 5.8.8 to 5.10 under MacOSX and Eclipse EPIC

2009-01-18 Thread Steven Sankaran
Hello,
So, I was going through a tutorial and I realized that my Eclipse
install is using an older version of Perl that does not recognize the
"say" command. I have attempted updating Perl to 5.10 using the
ActivePerl-5.10.pkg ,however, as far as I can tell, that doesn't seem
to be working. I am currently running the latest version of Mac OSX,
which is currently running 5.8.8. How do I update this to 5.10, so
that I may use the "say" command? I run the installer, but it does not
seem to be helping. Is there something I am missing?

Any help would be greatly appreciated,
Thank you.

-Steven

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Using hashes in a format

2009-01-18 Thread John W. Krahn

Adam Jimerson wrote:


Yea I read that dbmopen was superseded by the "tie" function but I couldn't 
figure out the permissions for it:


tie(%HIST, 'NDBM_File', '/usr/lib/news/history', 1, 0);


perldoc DB_File

[ snip ]

Default Parameters

It is possible to omit some or all of the final 4 parameters in the
call to "tie" and let them take default values. As DB_HASH is the
most common file format used, the call:

tie %A, "DB_File", "filename" ;

is equivalent to:

tie %A, "DB_File", "filename", O_CREAT|O_RDWR, 0666, $DB_HASH ;


Use the Fcntl module for the O_CREAT and O_RDWR constants.


Which is what I though the 1,0 was there for.  A quick question though, any 
certain reason why you used DB_File in your code over any of the other 
databases?


No.  Use any one that suits your needs.



John
--
Those people who think they know everything are a great
annoyance to those of us who do.-- Isaac Asimov

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Newbie question about variables, arrays and where they all go

2009-01-18 Thread dolphin_sonar
   1 # When calling 'running_sum(5, 6);' the variable 'state @numbers'
receives those two
   2 # parameters, (5 and 6), right? Then, the @numbers array also
copies/stores (5 and 6)
   3 # into the special '( @_ )' variable as well, right? Also, line
13 pushes '$number' into
   4 # the '@numbers' array each time through the foreach loop,
right?
   5 # For instance, it pushes 5 to the end of the array the first
time around,
   6 # then pushes 6 to the end of the array the next time around.
   7
   8 sub running_sum {
   9state $sum = 0;
  10state @numbers;
  11
  12foreach my $number ( @_ ) {
  13push (@numbers, $number);
  14$sum += $number;
  15}
  16say "The sum of (@numbers) is $sum";
  17 }
  18
  19 running_sum( 5, 6 );


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Using hashes in a format

2009-01-18 Thread Adam Jimerson
"John W. Krahn" wrote:

> Adam Jimerson wrote:
>> I am working on a program that will act as a contact manager of sorts, 
>> it uses two hashes to store everything (although the second one is
>> commented
>> out because I am not ready to work with it).  I am using the format
>> function to display everything but I don't know how to get it to show the
>> keys to the
>> hash which is where the names are.  Here is my code so far to show what I
>> am talking about:
>> 
>> ,[ CODE ]
>> #!/usr/bin/perl
>> use warnings;
>> use strict;
>> 
>> #define hashes
>> my %phone_numbers = ();
>> #my %email_address = ();
>> my $full_name;
>> my $phone_number;
>> 
>> print "CSCC Workstudy/Co-Op/Intern Contact Manager\n";
>> print "Version 0.6\n";
>> 
>> if ("@ARGV" eq 'add') {
> 
> That should be:
> 
> if ($ARGV[0] eq 'add') {
> 
> 
>> dbmopen(%phone_numbers, "$ENV{HOME}/phone_numbers", 0766) || die "Can't
>> open database: $!\n"; #Open database for writing
> 
> perldoc -f dbmopen
>  dbmopen HASH,DBNAME,MASK
>  [This function has been largely superseded by the "tie"
>  function.]
> 
> perldoc -f tie
> perldoc AnyDBM_File
> perldoc DB_File
> perldoc GDBM_File
> perldoc NDBM_File
> perldoc ODBM_File
> perldoc SDBM_File
> 
> 
>> print "\nFull Name: ";
>> chomp($full_name = );
>> print "Phone Number: ";
>> chomp($phone_number = );
>> $phone_numbers { $full_name } = $phone_number;
>> dbmclose(%phone_numbers) || die "Can't close database $!\n"; #saves and
>> closes the database
>> exit 0;
>> } elsif ("@ARGV" eq 'view') {
>> dbmopen(%phone_numbers, "$ENV{HOME}/phone_numbers", 0666) || die "Can't
>> open database: $!\n"; #Open database for reading
>> foreach (keys %phone_numbers) {
>> write;
>> }
>> exit 0;
>> } else {
>> die "Usage: $0 [add|view]\n";
>> }
>> 
>> format STDOUT =
>> @<<< @##-###-
> 
> @##-###- is not a valid format string, that is a three digit number
> followed by the literal string '-###-'.
> 
> 
>> $phone_numbers{$_} #needs to print the keys of the hash for the name, and
>> values for the phone number so it will be like this "Some Name
>> 555-555-" .
>> 
>> format STDOUT_TOP =
>> Full Name Phone Numbers
>> = =
>> .
> 
> You probably want something more like this:
> 
> #!/usr/bin/perl
> use warnings;
> use strict;
> use DB_File;
> 
> print "CSCC Workstudy/Co-Op/Intern Contact Manager\n",
>"Version 0.6\n";
> 
> @ARGV == 1 or die "Usage: $0 [add|view]\n";
> 
> # define hashes
> tie my %phone_numbers, 'DB_File', "$ENV{HOME}/phone_numbers"
>  or die "Can't open $ENV{HOME}/phone_numbers: $!\n";
> #tie my %email_address, 'DB_File', "$ENV{HOME}/email_address"
> #or die "Can't open $ENV{HOME}/email_address: $!\n";
> 
> if ( $ARGV[ 0 ] eq 'add' ) {
>  print "\nFull Name: ";
>  chomp( my $full_name =  );
>  print "Phone Number: ";
>  chomp( my $phone_number =  );
>  $phone_numbers{ $full_name } = join '-', $phone_number =~
> /(\d{3})\D*(\d{3})\D*(\d{4})$/;
> }
> elsif ( $ARGV[ 0 ] eq 'view' ) {
>  for ( keys %phone_numbers ) {
>  write;
>  }
> }
> 
> format STDOUT_TOP =
> Full Name Phone Numbers
> = =
> .
> 
> format STDOUT =
> @<<< @>>>
> $_, $phone_numbers{$_}
> .
> 
> untie %phone_numbers;
> exit 0;
> 
> __END__
> 
> 
> 
> John

Yea I read that dbmopen was superseded by the "tie" function but I couldn't 
figure out the permissions for it:

tie(%HIST, 'NDBM_File', '/usr/lib/news/history', 1, 0);

Which is what I though the 1,0 was there for.  A quick question though, any 
certain reason why you used DB_File in your code over any of the other 
databases?


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Using hashes in a format

2009-01-18 Thread Adam Jimerson
(Randal L. Schwartz) wrote:

>> "Adam" == Adam Jimerson  writes:
> 
> Adam> my %phone_numbers = ();
> ...
> Adam> $phone_numbers{$_} #needs to print the keys of the hash for the
> name, and Adam> values for the phone number so it will be like this "Some
> Name 555-555-" Adam> .
> 
> Back in the day, formats couldn't access lexical (my) variables. I think
> this
> got changed, but I stopped paying attention to formats five years ago. 
> Why are you using formats?
> 

I decided to use formats because I figured it would be an easy way to have 
it print out the report the way I want the end result to be.


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Using hashes in a format

2009-01-18 Thread Randal L. Schwartz
> "Adam" == Adam Jimerson  writes:

Adam> my %phone_numbers = ();
...
Adam> $phone_numbers{$_} #needs to print the keys of the hash for the name, and 
Adam> values for the phone number so it will be like this "Some Name 
555-555-"
Adam> .

Back in the day, formats couldn't access lexical (my) variables. I think this
got changed, but I stopped paying attention to formats five years ago.  Why
are you using formats?

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Using hashes in a format

2009-01-18 Thread John W. Krahn

Adam Jimerson wrote:
I am working on a program that will act as a contact manager of sorts,  it 
uses two hashes to store everything (although the second one is commented 
out because I am not ready to work with it).  I am using the format function 
to display everything but I don't know how to get it to show the keys to the 
hash which is where the names are.  Here is my code so far to show what I am 
talking about:


,[ CODE ]
#!/usr/bin/perl
use warnings;
use strict;

#define hashes
my %phone_numbers = ();
#my %email_address = ();
my $full_name;
my $phone_number;

print "CSCC Workstudy/Co-Op/Intern Contact Manager\n";
print "Version 0.6\n";

if ("@ARGV" eq 'add') {


That should be:

if ($ARGV[0] eq 'add') {


	dbmopen(%phone_numbers, "$ENV{HOME}/phone_numbers", 0766) || die "Can't 
open database: $!\n"; #Open database for writing


perldoc -f dbmopen
dbmopen HASH,DBNAME,MASK
[This function has been largely superseded by the "tie"
function.]

perldoc -f tie
perldoc AnyDBM_File
perldoc DB_File
perldoc GDBM_File
perldoc NDBM_File
perldoc ODBM_File
perldoc SDBM_File



print "\nFull Name: ";
chomp($full_name = );
print "Phone Number: ";
chomp($phone_number = );
$phone_numbers { $full_name } = $phone_number;
	dbmclose(%phone_numbers) || die "Can't close database $!\n"; #saves and 
closes the database

exit 0;
} elsif ("@ARGV" eq 'view') {
	dbmopen(%phone_numbers, "$ENV{HOME}/phone_numbers", 0666) || die "Can't 
open database: $!\n"; #Open database for reading

foreach (keys %phone_numbers) {
 write;
}
exit 0;
} else {
die "Usage: $0 [add|view]\n";
}

format STDOUT =
@<<< @##-###-


@##-###- is not a valid format string, that is a three digit number 
followed by the literal string '-###-'.



$phone_numbers{$_} #needs to print the keys of the hash for the name, and 
values for the phone number so it will be like this "Some Name 555-555-"

.

format STDOUT_TOP =
Full Name Phone Numbers
= =
.


You probably want something more like this:

#!/usr/bin/perl
use warnings;
use strict;
use DB_File;

print "CSCC Workstudy/Co-Op/Intern Contact Manager\n",
  "Version 0.6\n";

@ARGV == 1 or die "Usage: $0 [add|view]\n";

# define hashes
tie my %phone_numbers, 'DB_File', "$ENV{HOME}/phone_numbers"
or die "Can't open $ENV{HOME}/phone_numbers: $!\n";
#tie my %email_address, 'DB_File', "$ENV{HOME}/email_address"
#or die "Can't open $ENV{HOME}/email_address: $!\n";

if ( $ARGV[ 0 ] eq 'add' ) {
print "\nFull Name: ";
chomp( my $full_name =  );
print "Phone Number: ";
chomp( my $phone_number =  );
$phone_numbers{ $full_name } = join '-', $phone_number =~ 
/(\d{3})\D*(\d{3})\D*(\d{4})$/;

}
elsif ( $ARGV[ 0 ] eq 'view' ) {
for ( keys %phone_numbers ) {
write;
}
}

format STDOUT_TOP =
Full Name Phone Numbers
= =
.

format STDOUT =
@<<< @>>>
$_, $phone_numbers{$_}
.

untie %phone_numbers;
exit 0;

__END__



John
--
Those people who think they know everything are a great
annoyance to those of us who do.-- Isaac Asimov

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Make substitution output depend on buffer state

2009-01-18 Thread Markus
Hi,

I have a list of different text patterns and I'm only interested
in a certain part of their content, which is different for each 
pattern. The main constraint is doing this within a substitution 
statement.

$split_regex has 4 different expressions with one buffer each.
Each input string contains one or more patterns. Thus I have to 
seperate the output string to be able to see their boundaries. 
My main itch are the additional whitespaces I'd have if one of 
the buffers is empty:

$subst =~ 
s/(?:(?:$first_regex|$second_regex|$third_regex|$fourth_regex)[\/\s]?)+/\1 \2 
\3 \4/;

Because of this, I resorted to the following solution, which I
deem not particularly elegant, but which prints no unnecessary 
whitespace:

$subst =~ 
s/(?:(?:$first_regex|$second_regex|$third_regex|$fourth_regex)[\/\s]?)+/($1?$1."
 ":"").($2?$2." ":"").($3?$3." ":"").($4?$4." ":"")/e;

Does anybody have an idea/hint/suggestion how to accomplish this
without using the /e modifier, ie. with regex syntax only?

Thanks in advance,
Markus


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Perl UNIX shell PATH problem

2009-01-18 Thread Mr. Shawn H. Corey
On Sun, 2009-01-18 at 15:36 +, Andy Smith wrote:
> Odd one, must be missing something basic! :P
> 

The problem is that your servers were set up at different times.  Or
rather, your company does not have rigorous policies for setting up
servers.  Your development and test environments must be an exact match
of your production ones and all your production servers must match.
Failure to do so means delays in tracking down bugs that could have been
avoided.  The sad part is that this has been known for over 50 years and
people are still stumbling over it.  And even sadder is that is always
seems to be the programmer to has to try to fix it.  Sigh.


-- 
Just my 0.0002 million dollars worth,
  Shawn

Programming is as much about organization and communication
as it is about coding.

"It would appear that we have reached the limits of what it is
 possible to achieve with computer technology, although one should
 be careful with such statements, as they tend to sound pretty silly
 in 5 years."
   --John von Neumann, circa 1950


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Perl UNIX shell PATH problem

2009-01-18 Thread Andy Smith

Hi,

  yep, /etc/profile the same on both systems:

ls -ld /etc/profile*
-rw-r--r--  1 root  wheel  2032 Jan 16 15:40 /etc/profile
-rw-r--r--  1 root  wheel   645 Jan 16 15:40 /etc/profile.old

 ls -ld /etc/profile*
-rw-r--r--  1 root  wheel  2032 Jul 13  2006 /etc/profile

(I copied the profile from the working server to the not working  
server so I knew they were the same)


Yeah, I can stick that extra code into the perl, but each time the  
package is updated Ill have to vi the perl. Also I have a work around  
of puting a link for the traceroute binary into /usr/bin... But more  
than that I just wanted to understand my system, and I still dont :S


Odd one, must be missing something basic! :P

thanks, Andy.

Try:
ls -ld /etc/profile* /etc/bash*

In Perl, before you call traceroute:

$ENV{PATH} .=  
':/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin';





This message was sent using IMP, the Internet Messaging Program.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: String replacement involving special characters.

2009-01-18 Thread Gunnar Hjalmarsson

Blue wrote:

$string = "aaa ' ccc ";
$string =~ s/'/bbb/eg;

The above replaces the single-quotation mark with bbb. The result will
be:
aaa bbb ccc

How do I modify it so that the single-quotation mark is replaced with
\' (a backslash and a single-quotation mark) resulting in:
aaa \' ccc


Is there any problem with all the help you got at comp.lang.perl.misc?

http://groups.google.com/group/comp.lang.perl.misc/browse_thread/thread/5a7fa1359dc2b851

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Query : Exectuting flow in parllel dirs

2009-01-18 Thread vivekananda.mohana
Hi,
 Pls help with the correct syntax. Appreciate the help. Thanks

Regards,
Vivek




From: Vivekananda Mohana (WT01 - PES-Semi-Technology)
Sent: Friday, January 16, 2009 3:23 PM
To: 'beginners@perl.org'
Subject: Query : Exectuting flow in parllel dirs


Hi,
   I have written a small perl script to do some internal function for
our project. Actually, it has to do a series of steps for say n number
of inputs. Currently, its doing it in series and in the same dir.
I need help for the script to run in
1) 5 parallel runs if n is 5
2) in individual dirs.
Pls let me know the syntax to create parallel dirs and submit the jobs
parallely. Thanks!

Regards,
Vivek




Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email. 

www.wipro.com
<>

Using hashes in a format

2009-01-18 Thread Adam Jimerson
I am working on a program that will act as a contact manager of sorts,  it 
uses two hashes to store everything (although the second one is commented 
out because I am not ready to work with it).  I am using the format function 
to display everything but I don't know how to get it to show the keys to the 
hash which is where the names are.  Here is my code so far to show what I am 
talking about:

,[ CODE ]
#!/usr/bin/perl
use warnings;
use strict;

#define hashes
my %phone_numbers = ();
#my %email_address = ();
my $full_name;
my $phone_number;

print "CSCC Workstudy/Co-Op/Intern Contact Manager\n";
print "Version 0.6\n";

if ("@ARGV" eq 'add') {
dbmopen(%phone_numbers, "$ENV{HOME}/phone_numbers", 0766) || die "Can't 
open database: $!\n"; #Open database for writing
print "\nFull Name: ";
chomp($full_name = );
print "Phone Number: ";
chomp($phone_number = );
$phone_numbers { $full_name } = $phone_number;
dbmclose(%phone_numbers) || die "Can't close database $!\n"; #saves and 
closes the database
exit 0;
} elsif ("@ARGV" eq 'view') {
dbmopen(%phone_numbers, "$ENV{HOME}/phone_numbers", 0666) || die "Can't 
open database: $!\n"; #Open database for reading
foreach (keys %phone_numbers) {
 write;
}
exit 0;
} else {
die "Usage: $0 [add|view]\n";
}

format STDOUT =
@<<< @##-###-
$phone_numbers{$_} #needs to print the keys of the hash for the name, and 
values for the phone number so it will be like this "Some Name 555-555-"
.

format STDOUT_TOP =
Full Name Phone Numbers
= =
.
`


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: String replacement involving special characters.

2009-01-18 Thread Mr. Shawn H. Corey
On Fri, 2009-01-16 at 10:56 -0800, Blue wrote:
> $string = "aaa ' ccc ";
> $string =~ s/'/bbb/eg;
> 
> The above replaces the single-quotation mark with bbb. The result will
> be:
> aaa bbb ccc
> 
> How do I modify it so that the single-quotation mark is replaced with
> \' (a backslash and a single-quotation mark) resulting in:
> aaa \' ccc
> 
> 

See `perldoc perlre` and search for /\\Q/


-- 
Just my 0.0002 million dollars worth,
  Shawn

Programming is as much about organization and communication
as it is about coding.

"It would appear that we have reached the limits of what it is
 possible to achieve with computer technology, although one should
 be careful with such statements, as they tend to sound pretty silly
 in 5 years."
   --John von Neumann, circa 1950


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




String replacement involving special characters.

2009-01-18 Thread Blue
$string = "aaa ' ccc ";
$string =~ s/'/bbb/eg;

The above replaces the single-quotation mark with bbb. The result will
be:
aaa bbb ccc

How do I modify it so that the single-quotation mark is replaced with
\' (a backslash and a single-quotation mark) resulting in:
aaa \' ccc


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Maximizing IE using Win32::IEAutomation

2009-01-18 Thread Collaborate
I use the following to open a webpage with the intent to have the IE
window maximized. However, the window opens in a  small size.

my $ie = Win32::IEAutomation->new(visible=>1, maximize=>1);
$ie->gotoURL('http://www.google.com', 0);

Is there anything that needs to be done differently? Are there other
packages that can do the IE window maximization?

Thanks for your input.


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/