Talkback for article: 114, September1999

Perl I

Back to: http://cgi.linuxfocus.org/English/September1999/article114.html

From: Roger Shultes <morphus2001(at)hotmail.com> [ date: 2001-05-19 ]
i am tryin to learn perl and was woundering if there was a text book and work book out on the market??
also i live in tampa fl and was wondering if there was a school near by that i could learn from?
tryin Roger Shultes
From: negi <negi009(at)yahoo.com> [ date: 2002-04-04 ]
I am parsing the Blast output file but getting the following error. My data is something like that

A60054 1 MAQALLVPPGPESFRLFTRESLAAIEKRAAEEKAKKPKKEQDIDDENKPKPNSDLEAGKN 60
NP_037251 1 MAQALLVPPGPESFRLFTRESLAAIEKRAAEEKAKKPKKEQDIDDENKPKPNSDLEAGKN 60
AAD17315 1 MEPPLHIPPGPDSLRFFTRESFQAIEKRIAEEKAKKPKQDRRDDDENGPKPNRDLEAGKS 62
\ \
| |
P D
I48107 1 MARSVLVPPGPDSFRFFTRESLAAIEQRIAEEKAKRPKQERKDDDENGPKPNSDLEAGKS 61
\
|
E

I want to remove the backslash \ and | from this data. I am unable to do so. Please let me know how to do this.

regards
negi
From: guido socher [ date: 2002-04-04 ]
This is a reply to the previous talkback:

Use
perl -i.bak -pe 's/[\\\|]//g' yourfile.txt
From: eva <flipdaclip(at)gmx.net> [ date: 2002-04-26 ]
hi there, thanks for the help i got thru this page. :-)
got one more question tho. how do i get linebreaks in formulars (just like


this one) preserved? im having the text read into a database by perl, and it appears without breaks in html once its read out of the database.

thank you.
greets,
eva





From: manish kr pankaj <mkpankaj(at)iitk.ac.in> [ date: 2002-06-03 ]
i want to know how can i make a function which can accept a string but display
only the word not the spaces befor , after or inbetween the given sting
for eg:---- my name is manish kr pankaj
it must display mynameismanishkrpankaj
From: Anthony Bayot <salcedo32000(at)yahoo.com> [ date: 2002-09-12 ]
it so great. it was easy to visit your website in order to conduct an information about the perl language specially on the latest development of it.
From: Hung Phan <hung.phan(at)sun.com> [ date: 2004-04-01 ]
Hi,

Can you help to coorect my program, I would like to create a
perl update program, but I am unable to find the correct
syntax.

1) I have the test.txt file:
Eample:

HUNG|SEAN1|HUNGPHAN|PJAN
LINDA|EDWIN|ALANA|JIM
ALLEN|JOHN|MARY|JAMES
ALAN|ALAN1|ALAN2|LUCY
ALAN2|JUNG|HUNG3|LUCKY


2) I got the read and search .cgi can read this file. and also
search for the string I would like to searh.


Example:

I search for string LINDA, it will find and display to the brower.
It is no proble,.

3) After I found the string on that line, I would like to replace
the string, I wrote a program would like to update, but I would like
to removed the session ask the input file name.

and I would like to keep the same file name test.txt. Instead of
create a new file name to extension .stp. How I can do that, please
help, below is my update.pl program:


#!/usr/bin/perl
#
#

if ($ARGV[0]){
$file_name= $ARGV[0]
}

else
{
print "Enter the name of the file to strip of spaces: ";
$file_name = <STDIN>;
chomp($file_name);

# new add today

print "Enter the old_string: ";
$old_string = <STDIN>;
chomp($old_string);

print "Enter the new_string: ";
$new_string = <STDIN>;
chomp($new_string);
}

open (IN, $file_name) || die "Can't open file for input!";
$_ = $file_name;

if(s/\..*/\.stp/)
{
$file_name = $_;
open(OUT, "> $file_name");
}
else
{
open(OUT, "> $file_name.stp");
}

# This seesion will be searcg/replace the string.

while(<IN>)
{
chomp;
#s/ //g;
s/$old_string/$new_string/g;
print OUT "$_\n";
}



I am ver appreciate your help.
Hung
From: Fitzek [ date: 2006-10-17 ]
I couldn't execute the perl programm, i followed the decsribtion on the page but it didn't work.

Can you please help me?

From: Fitzek [ date: 2006-10-17 ]
I couldn't execute the perl programm, i followed the decsribtion on the page but it didn't work.

Can you please help me?

9 talkbacks




Due to the increased amount of web spam we have deciced to removed the talkback posting possibility. You can read old talkbacks but you can no longer post new ones.

Back to http://cgi.linuxfocus.org/English/September1999/article114.html

Please contact webmaster(at)linuxfocus.org if you have any questions with regards to this talkback

lftalkback version 3.10