Re: download a protein sequence from the web using LWP module
Please avoid posting these kind of requests. The forum is here to sort out our problems, not to solve your homework !! Regards, Suvajit [EMAIL PROTECTED] wrote: SET A 1. Write a perl script to find the number of spaces in a given sentence using regular expression. 2. Write a perl script to take name from command line argument and print the inputted name in both lower case and upper case. (use functions) 3. Write a perl script to evaluate sine series. 4. Write a perl script to download a protein sequence from the web using LWP module SET B 1. Write a perl script to convert a given gene into mrna using regular expression 2. Write a perl script to check whether a given file format is fasta file or not and if it is so print its sequence only. (use file handles) 3. Write a perl script to arrange the given set of numbers in descending order and print the largest out of it. 4. Write a perl script to download a protein sequence from the web using LWP module SET C 1. Write a perl script to find the number of vowels in a given sentence using regular expression 2. Write a perl script to duplicate a file print no. of lines in it. 3. Write a perl script for finding the factorial of given number. 4. Write a perl script to download a protein sequence from the web using LWP module SET D 1. Write a perl script to find the percentage of ATGC using regular expression 2. Write a perl script to take line from command line arguments and then count number of vowels in that line 3. Write a perl script to calculate a Fibonacci series of given number. 4. Write a perl script to download a protein sequence from the web using LWP module please give me the answers of these questions. very-2 thanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Execute newgrp system command
Hi, I want to login into a new group using 'newgrp' UNIX command.Every newgrp command invokes a new shell. But when I am trying to execute this system command from a perl script the script is terminating and returning the prompt of the new shell . Can anyone suggest on what can be done to change into a new group from within perl script? Regards, Suvajit -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Execute newgrp system command
Hi, Thanks for the suggestion. There are some tasks which are directly tied to the group-id. Owing to the requirement it may happen my perl script need to switch groups to achieve a specific task. So my plan is to change to a new group with new grp command after exporting the Environment/required variables from the current shell. After the newgrp system command from a perl script could not satisfy my need I tried including the command in a separate .cshrc file and then just sourcing that file from a perl script. But this job could not again be executed from perl script . The perl script returns error telling the sourced file could not be found. Moreover changing the scripts group permission wont do hold good for my case. I am at bay now !! Regards, Suvajit Shawn Corey wrote: Suvajit Sengupta wrote: Hi, I want to login into a new group using 'newgrp' UNIX command.Every newgrp command invokes a new shell. But when I am trying to execute this system command from a perl script the script is terminating and returning the prompt of the new shell . Can anyone suggest on what can be done to change into a new group from within perl script? Short answer: You can't. Long answer: The newgrp command will always run a new shell regardless if it succeeds or fails. What you can do instead is set the effective group id for the script. 1. Change the script's group to the group you want it to work under (see `man chgrp`). 2. Change the script's set group id on execution flag (see `chmod`). The script will now run under the new group. See `perldoc perlvar` and search for $) and $(. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Check empty hash
Hi, How can I test whether a hash is empty or not ? For e.g: I have reference to a hash , say $preCommand and I get $preCommands as {} , Its an empty hash, but it exists and is also defined. I need to check whether the hash is empty or not. Does anyone has any clue ? Regards, Suvajit -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Check empty hash
Hi, I have used Data::Dumper to get the hash. I can test myself that the hash is empty. But how can test in by script that the hash is empty? Regards, Suvajit [EMAIL PROTECTED] wrote: HI, You can use Data::Dumper And print the hash reference as, use Data::Dumper print Dumper ($preCommands); If the output is VAR1= {}; Then there are no entries in the has tables HTH Regards, Shaman -Original Message- From: Suvajit Sengupta [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 16, 2005 4:33 PM To: Perl Beginners List Subject: Check empty hash Hi, How can I test whether a hash is empty or not ? For e.g: I have reference to a hash , say $preCommand and I get $preCommands as {} , Its an empty hash, but it exists and is also defined. I need to check whether the hash is empty or not. Does anyone has any clue ? Regards, Suvajit -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response Confidentiality Notice 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 confidential or privileged information. If you are not the intended recipient, please notify the sender at Wipro or [EMAIL PROTECTED] immediately and destroy all copies of this message and any attachments. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Check empty hash
Thanx, Beau ..it worked !! Regards, Suvajit Beau E. Cox wrote: Hi Suvajit Sengupta - At 2005-11-16, 01:32:31 you wrote: Hi, How can I test whether a hash is empty or not ? For e.g: I have reference to a hash , say $preCommand and I get $preCommands as {} , Its an empty hash, but it exists and is also defined. I need to check whether the hash is empty or not. Does anyone has any clue ? Regards, Suvajit Try: unless( keys %$preCommands ) { ...hash is empty... } You can use 'keys %hash' ( or if necessary 'scalar keys %hash' ) to get a count of the number of hash elements just like @array for arrays. Aloha = Beau; [EMAIL PROTECTED] 2005-11-16 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Rename a file.
Hi, needs further details of the script. Regards, Suvajit Pant, Hridyesh wrote: Hi while renaming a file I am getting below error on windows environment.. Couldn't rename to : Permission denied Couldn't rename to : Permission denied Couldn't rename to : Permission denied Can any body suggest me...how to remove this error.. Thanks Hridyesh -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: white space between roam and act
Hi, To ignore the white space in between ROAM and ACT use /x modifier of Perl RE to extend your pattern's legibility by permitting whitespace and comments. Hope that will serve your purpose. Instead of if ($msg =~ /roam act/i) Use if ($msg =~ /roam act/ix) Regards, Suvajit K.Moeng wrote: Hello again, I have rephrased my question from yesterday, I want to be able to ignore the white space in between ROAM and ACT that is return the query as ROAM ACT without falling to the else statement. $msg = $ARGV[0]; $msg =~ s/\/' /ig; $found = 0; if ($msg =~ /roam act/i) { $name = 'ACTivated'; $found = 1; } elsif ($msg =~ /roam dact/i) { $name = 'DeACTivated'; $found = 1; } if ($found == 1) print .Thank you..\n; } else { print Sorry. Your request has not been sent for Roaming.\n; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: how to find missing value.
Hi, If the array A is a list of consecutive N natural numbers, then missing number,n = Sum of N natural numbers + Sum of the numbers in Array A. Regards, Suvajit Jabir Ahmed wrote: Hello I need to know the best way to get a missing element from an array. i have an array @a of size containing values 1 to 101 with one value missing. eg: @a=qw( 1 2 3 4 5 6 8 9 10 101); (the array is not sorted and its only to make it easier to understand) now i need to find out the missing value i.e 7 . if i run a loop then it needs to run n x n number of times. kindly suggest. Thanks Jabir I do the diffcult immediately,but the impossible take's a little longer!!! Cresent canaopy apartments #19 Davis Road, Thomas town, Bangalore -84 Phone (mobile) : +91-98867 01148 E-Mail: [EMAIL PROTECTED],[EMAIL PROTECTED] __ Yahoo! Music Unlimited Access over 1 million songs. Try it free. http://music.yahoo.com/unlimited/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: hi
Hi, Can you post the whole script. Possibly you have declared 'use strict' in your code or it has been set default. The problem is that the compiler is demanding explicit declaration of the variables that you have used. declaring @shrimp as : my @shrimp = COO; and foreach my $tuna (@shrimp) { squid=substr($tuna,0,4); ...and so on } will eliminate the error. Regards, Suvajit ZHAO, BING wrote: Hi, I am doing this simple enough script, but somehow it generates error: open COO, 1898.inf or die Cannot open file 1898.inf:$!; @shrimp=COO; foreach @shrimp{ $squid=substr($_,0,4); $shark=$_..pdb; system \rm dali.lock; #ignore this part system dalilite ~readbrk pdb1898/$shark $squid; #ignore this part } Global symbol @shrimp requires explicit package name at ./pdbReadbrk2000.pl line 19. syntax error at ./pdbReadbrk2000.pl line 21, near foreach @shrimp Global symbol $to requires explicit package name at ./pdbReadbrk2000.pl line 21. thank you all, what did I do wrong? best, -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Problem reading data from an HTML file
Nath, Alok (STSD) wrote: Can anyone point out why it is not outputting anything ? It is suppose to read an HTML file and display the table contents. One thing I observed is - It is not entering the for loop and I s not printing anything ( in print Table found at , join(',', $ts-coords), :\n;) #!/usr/bin/perl use warnings ; use strict ; use LWP::Simple ; use HTML::TableExtract ; my $html_string = test.htm ; my $te = new HTML::TableExtract(depth=3,count=4,gridmap=1) ; $te-parse($html_string); foreach my $ts ($te-table_states) Instead of using $te-table_states try using $te-tables in the above line. { print Table found at , join(',', $ts-coords), :\n; foreach my $row ($ts-rows) { print join(',', @$row), \n; print @{$row} ,\n; } } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
[Fwd: Re: Infinite loop problem]
Hi Vineet, Since Perl provides strong feature of pattern matching of Regular Expn you should use that. Just read in the pattern GAGAGAGAGGA from the file and store it in a scalar variable. You can refer to the following perl code snippet for getting yout job done. #! /usr/bin/perl my $x = 'GAGAGAGAAAGG'; $x =~ s/G/GLY/g; # Search for pattern G globally and replace it with 'GLY' $x =~ s/A/ALA/g; # Search for pattern A gloablly and replace it with 'ALA' print $x; # Print replaced string 1. Read in the string from your file . 2. Search and replace the string as required 3. Write the string in another file The code wont take more than 10-12 lines. And the beauty is you dont have to iterate over your string. Regards, Suvajit Vineet Pande wrote: Dear Perl Guru: I want to write a script which takes input a text file with sequence of alphabets (amino acids) like GAGAGAGAGGA etc. and converts them to a three letter corresponding code [G= GLY, A= ALA]. The output should be then written to another file. I wrote the following script, but it seems it goes in an infinite loop and only prints GLY GLY GLYinfinitely for an input of GAAAGAGAAGA etc. Any suggestions? Thanks in advance -Vineet #!/usr/bin/perl use warnings; my $fasta_file = fasta.txt; #this contains single letter code# chomp $fasta_file; my $charmm_file = charmm.txt; #this is expected to have three letter converted# unless (open (IN, $fasta_file) ) { print Cannot open file \fasta_file\\n\n; exit; } open OUT, $charmm_file or die; @protein = IN; close IN; $protein = join( '', @protein); $protein =~ s/\s//g; for ( $position=0; $position length $protein; ++$protein ) { $aa = substr($protein, $position, 1); if ($aa eq 'G') { $praa = GLY ; print OUT $praa; } elsif ($aa eq 'A') { $prab = ALA ; print OUT $prab; } else { exit; } } close OUT; ** _ FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response