perl code problem (open file)
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix administration > perl code problem (open file)




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    perl code problem (open file)  
yezi


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-30-05 11:00 PM

HI, Everyone:

I have question regarding to the PERL code. The task is open a tons of
files one by one according to the serial number order and process the
context in these files.However the file should be specified by the
serial number and site name.

The name of file  has structure like that:
serial number. site name . * .like :

0.site1.1.23.txt.rd.ed
1.site1.2.23.txt.rd.ed
3.site1.3.24.txt.rd.ed

which means only one column "site1" is same, so my question is can I
write following code to open them ?

open myfile,"$serial.$site.*.ed" or die "Could not open file
$serial.$site for reading/n";

Can I use * in the open file function? I tried, but fail. I do not know
why, how to relize the function?

thanks for any comments






[ Post a follow-up to this message ]



    Re: PERL code problem (open file)  
Mike


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-30-05 11:00 PM

On 2005-08-30, yezi <ye_line@hotmail.com> wrote:
> HI, Everyone:
>
> I have question regarding to the PERL code. The task is open a tons of
> files one by one according to the serial number order and process the
> context in these files.However the file should be specified by the
> serial number and site name.
>
> The name of file  has structure like that:
> serial number. site name . * .like :
>
> 0.site1.1.23.txt.rd.ed
> 1.site1.2.23.txt.rd.ed
> 3.site1.3.24.txt.rd.ed
>
> which means only one column "site1" is same, so my question is can I
> write following code to open them ?
>
> open myfile,"$serial.$site.*.ed" or die "Could not open file
> $serial.$site for reading/n";
>
> Can I use * in the open file function? I tried, but fail. I do not know
> why, how to relize the function?
>
> thanks for any comments
>

Use the glob command.

$ perldoc -f glob





[ Post a follow-up to this message ]



    Re: PERL code problem (open file)  
Robert Melson


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-30-05 11:00 PM

In article <H11Re.20835$1g2.20562@fe05.lga>,
Mike <mikee@mikee.ath.cx> writes:
> On 2005-08-30, yezi <ye_line@hotmail.com> wrote: 
>
> Use the glob command.
>
> $ perldoc -f glob

I'd also suggest "subscribing" to comp.lang.perl.misc or
comp.lang.perl.moderated.  Both are inhabited by experienced PERL users who
are, for the most part, happy to answer questions about their favorite langu
age.

Bob Melson

--
Robert G. Melson | Rio Grande MicroSolutions | El Paso, Texas
-----
"One of the greatest delusions in the world is the hope that the evils in th
is world are to be cured by legislation." Thomas Reed
-----






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 11:07 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register