Thursday, May 22, 2008

data:
abcdefgh
<----- (Blank space just enter enter)
ijklmno

Problem:
How do i tell perl to skip this line if i m making a loop????

sample:
while (<DATA>)
{
if ($_ =~ ????????????) <--- don t know
{
}
else
{
print OUT $_;
}
}

I have a value coming back in a Perl program that may be an array or just a single value. The problem is that I need to somehow determine this before trying to access it or I get an error. I could have the value 23 coming back or the value 23- 1- 3- 5 etc. Is there an intelligent/elegant way to deal with this problem?

im using the recommended open (FILE- ">>$file") with $file = "enquiries.txt"
i use ftp to upload my files to the server- i have created a perl script that resides on the server that takes information from html form posts- and is supposed to save it to the server- instead it tries to save it to the client pc instead

Can anyone kindly explain to me what does the following expression mean in PERL programming?

If (/^\s*\.*?\s+\.*?\s+(.*?)\s+.*\s*$/) {
print “$1\n”;
}

I m working on loops (For- while commands). I noticed that after the loop is finished you need to close the file and opn it again so that the cursor or the line $_ will start again from the top once you tried to loop the fil again. Is there anyway to make the cursor or line to go to the top of the file again while looping instead of closing an opening the file again and start another loop?

No comments: