Re: Variable Assignment

2011-08-16 Thread Octavian Rasnita
From: "shawn wilson" > On Aug 16, 2011 9:48 PM, "John W. Krahn" wrote: >> >> Joseph L. Casale wrote: >>> >>> What is the correct way to quickly assign the result of a regex against >>> a cmdline arg into a new variable: >>> >>> my $var = ($ARGV[0] =~ s/(.*)foo/$1/i); >> >> >> my ( $var ) = $ARGV[

Re: Variable Assignment

2011-08-16 Thread Jim Gibson
At 11:43 PM -0400 8/16/11, shawn wilson wrote: On Aug 16, 2011 9:48 PM, "John W. Krahn" wrote: Joseph L. Casale wrote: What is the correct way to quickly assign the result of a regex against a cmdline arg into a new variable: my $var = ($ARGV[0] =~ s/(.*)foo/$1/i); my ( $var ) = $AR

Re: Variable Assignment

2011-08-16 Thread shawn wilson
On Aug 16, 2011 9:48 PM, "John W. Krahn" wrote: > > Joseph L. Casale wrote: >> >> What is the correct way to quickly assign the result of a regex against >> a cmdline arg into a new variable: >> >> my $var = ($ARGV[0] =~ s/(.*)foo/$1/i); > > > my ( $var ) = $ARGV[0] =~ /(.*)foo/i; IIRC, that rede

Re: Variable Assignment

2011-08-16 Thread John W. Krahn
Joseph L. Casale wrote: What is the correct way to quickly assign the result of a regex against a cmdline arg into a new variable: my $var = ($ARGV[0] =~ s/(.*)foo/$1/i); my ( $var ) = $ARGV[0] =~ /(.*)foo/i; John -- Any intelligent fool can make things bigger and more complex... It takes a

why si this code not working (variable substitution)

2011-08-16 Thread Rajeev Prasad
    foreach $str1 (@arr1){  foreach (@arr2) {  @arr3 = split(/ /,"$_");  print "array = @arr3  element0 = $arr3[0] element1 = $arr3[1]";   #this is just to check, it showing values 0 and 1 as correctly assigned  print "$str1";  } }   arr1 contains lines like: (which will be values of str1 with eac

RE: Variable Assignment

2011-08-16 Thread Joseph L. Casale
>Yes, you can use: > >( my $var = $ARGV[0] ) =~ s/(.*)foo/$1/i; Rob/Octavian, Thanks for the quick help! jlc -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Variable Assignment

2011-08-16 Thread Octavian Rasnita
From: "Joseph L. Casale" What is the correct way to quickly assign the result of a regex against a cmdline arg into a new variable: my $var = ($ARGV[0] =~ s/(.*)foo/$1/i); Obviously that's incorrect but is there a quick way without intermediate assignment? Thanks! jlc Yes, you can use: ( my

Re: Variable Assignment

2011-08-16 Thread Rob Coops
On Tue, Aug 16, 2011 at 8:27 PM, Joseph L. Casale wrote: > What is the correct way to quickly assign the result of a regex against > a cmdline arg into a new variable: > > my $var = ($ARGV[0] =~ s/(.*)foo/$1/i); > > Obviously that's incorrect but is there a quick way without intermediate > assign

Variable Assignment

2011-08-16 Thread Joseph L. Casale
What is the correct way to quickly assign the result of a regex against a cmdline arg into a new variable: my $var = ($ARGV[0] =~ s/(.*)foo/$1/i); Obviously that's incorrect but is there a quick way without intermediate assignment? Thanks! jlc -- To unsubscribe, e-mail: beginners-unsubscr...@pe

Re: How can I install a perl module without a root authority?

2011-08-16 Thread universe sheep
The problem is :admin is not in now. 2011/8/17 Wernher Eksteen > If you can justify the need for it and the importance thereof, surely your > Linux/Unix Admin can install it > for you or provide you with the necessary sudo access so you can do it > yourself. That probably > depends on various fa

Re: Sorting a String

2011-08-16 Thread John W. Krahn
Matt wrote: I believe you can sort an array like so: sort @my_array; That should be: @my_array = sort @my_array; I need to sort a string though. I have $a_string that contains: 4565 line1 2345 line2 500 line3 etc. Obviously \n is at end of every line in the string. I need it sorted.

Re: Sorting a String

2011-08-16 Thread Brandon McCaig
On Tue, Aug 16, 2011 at 12:04 PM, Matt wrote: > I believe you can sort an array like so: > > sort @my_array; > > I need to sort a string though. > > I have $a_string that contains: > > 4565 line1 > 2345 line2 > 500 line3 > etc. > > Obviously \n is at end of every line in the string.  I need it sor

Re: How can I install a perl module without a root authority?

2011-08-16 Thread Wernher Eksteen
If you can justify the need for it and the importance thereof, surely your Linux/Unix Admin can install it for you or provide you with the necessary sudo access so you can do it yourself. That probably depends on various factors, ie if that's a production system, if change control needs to take pla

Re: How can I install a perl module without a root authority?

2011-08-16 Thread marcos rebelo
Look to local::lib in http://search.cpan.org/~apeiron/local-lib/lib/local/lib.pm On Tue, Aug 16, 2011 at 18:02, universe sheep wrote: > Without a root permission, I can't install perl module through normal way > such as CPAN. But I have to use this module(XML::Quote). > I have tried to copy the .

Re: Sorting a String

2011-08-16 Thread marcos rebelo
sort like string or like numbers? On Tue, Aug 16, 2011 at 18:04, Matt wrote: > I believe you can sort an array like so: > > sort @my_array; > > I need to sort a string though. > > I have $a_string that contains: > > 4565 line1 > 2345 line2 > 500 line3 > etc. > > Obviously \n is at end of every li

Sorting a String

2011-08-16 Thread Matt
I believe you can sort an array like so: sort @my_array; I need to sort a string though. I have $a_string that contains: 4565 line1 2345 line2 500 line3 etc. Obviously \n is at end of every line in the string. I need it sorted. How would I approach this? -- To unsubscribe, e-mail: beginner

How can I install a perl module without a root authority?

2011-08-16 Thread universe sheep
Without a root permission, I can't install perl module through normal way such as CPAN. But I have to use this module(XML::Quote). I have tried to copy the .pm file to my own lib directory directly, but it says "can't locate loadable perl module ". Is there any other way to install perl modules wi

Re: This is really a question for the Bioperl forum

2011-08-16 Thread Brandon McCaig
On Tue, Aug 16, 2011 at 11:00 AM, ANJAN PURKAYASTHA wrote: > print("$bacteria->id\t$bacteria->name\n"); ... > and the following ouput: > Bio::Taxon=HASH(0x158dbe0)->id    Bio::Taxon=HASH(0x158dbe0)->name You appear to intend to call methods on $bacteria, but since you're within a string what's re

Re: This is really a question for the Bioperl forum

2011-08-16 Thread shawn wilson
On Aug 16, 2011 11:02 AM, "ANJAN PURKAYASTHA" wrote: > > I wrote a short test script for the Bio::DB::Taxonomy module: > > #!/usr/bin/perl -w > use strict; > use Bio::DB::Taxonomy; > > my ($nodesfile, $namesfile)= ('nodes.dmp', 'names.dmp'); > > my

This is really a question for the Bioperl forum

2011-08-16 Thread ANJAN PURKAYASTHA
Hello all, I posted this question in the bioperl forum- no replies after a day, so let's see if anyone here can help. I wrote a short test script for the Bio::DB::Taxonomy module: #!/usr/bin/perl -w use strict; use Bio::DB::Taxonomy; my ($nodesfile