Re: Need a list of files in a dir.

2005-09-27 Thread bright true
Hello , in your examples you're opening "files" not dir's , to open a directory use this instead opendir(DIR,$dirname) or die $!; my @content = readdir(DIR); closedir(DIR); then to read files inside it , for (@content){ print ; } that's it , if you need to remove ("." and "..") which means the

Re: get value (name of file)

2005-07-21 Thread bright true
Hello , i think this would be a good way #!/usr/bin/perl -w use strict; my $file = 'data.csv'; open(FILE,$file); while(my $line = ){ my @wanted = split(/\|/,$line); print $wanted[0],"\n"; } close(FILE); On 7/21/05, Rob Coops <[EMAIL PROTECTED]> wrote: > > Try the following (this is just a sh

Re: reg exp help

2005-06-28 Thread bright true
Hello, First of all you're opening the file for writing Second i didn't understand what you really want , if you want to print out everything inside the file my $file = 'newfile.txt'; open(FILE,$file); while(){ print $_;} close(FILE); That's it with out matching or anything bye On 6/2

Mysql and PERL

2005-06-26 Thread bright true
Hello , anybody could give me some help on how to use mysql with Perl anything would help URLS , Examples etc... i searched and i found ... but it was incomplete examples Thanks , bye

Re: How to get the numeric index of a element in an array

2005-05-15 Thread bright true
hello , you can do something like the following my $counter = -1; foreach (@array){ $counter++; if($_ =~m/$word/){ print "Element ID is $counter";} } On 5/15/05, Frank <[EMAIL PROTECTED]> wrote: > > Ing. Branislav Gerzo wrote: > > >Frank [F], on Sunday, May 15, 2005 at 19:45 (+0800) typed

Re: rename files

2005-05-11 Thread bright true
The following would rename any file in a directory (.anything) into numbers in the same extention i hope it will be usfull opendir(DIR,"$dir") or print "$!"; my @content = sort(readdir(DIR)); closedir(DIR); my $no=0; *foreach my* $number (@content){ $no++; $number =~m/\S+\.(\S+)/; rename("$dir/

Re: The last element

2005-05-07 Thread bright true
$array[-1] On 5/7/05, amr <[EMAIL PROTECTED]> wrote: > > How can I call the last element in the array? > > I try the pop and it does the job but I think there is another way? > >

Re: accidently changed stdout | can't print to screen

2005-03-01 Thread bright true
Hello , sorry i didn't read it carefully .. well , first try by removing the "exit" at the END check the Error LOGS to see if there's an Error which make the output doesn't appear on the screen bye On Tue, 1 Mar 2005 10:40:53 -0500, Earthlink-m_ryan <[EMAIL PROTECTED]> wrote: > Has any

Re: accidently changed stdout | can't print to screen

2005-03-01 Thread bright true
Hello , are you trying to print out in a web browser ? ? if so ... then add the following line before your print line : print "content-type: text/html \n\n"; bye On Tue, 1 Mar 2005 10:40:53 -0500, Earthlink-m_ryan <[EMAIL PROTECTED]> wrote: > Has anyone ever accidentally changed the stdout

Re: Including one perl script in another

2005-02-24 Thread bright true
Hello , just add this line it will inculde the file require 'config.pl'; On Thu, 24 Feb 2005 08:35:17 +0200, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Greetings > How do I include a script in another one? For instance. I have a script called > myscript.pl and I have a second one called co

Unicode

2005-02-17 Thread bright true
Hello , any one could help me ? how could i get UCS2/HexEncoded chracters like Hello will return "00480065006C006C006F" Thank you -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: splitting by number

2005-02-17 Thread bright true
Hi , what i understand from what you wrote ... that you want to check if the files already exits you won't to copy it again so you can check that useing if(-e "location/Filename"){do something } this will return true whenever a file is exits ... if you want to copy whenever a file isn't exi

Re: How to add leading zeros?

2005-02-16 Thread bright true
Hi , i hope this would help you out @array = (1,2,3,40,51); foreach $line (@array){ if($line > 9 ){ $add = "0";}else{ $add = "00";} print $add$line,"";} bye On Wed, 16 Feb 2005 13:28:11 +0100, Bastian Angerstein <[EMAIL PROTECTED]> wrote: > > Hello, > > I have some Numbers 1 2 3 40 51 and

Re: write new file to same dir

2005-02-11 Thread bright true
Hi , actually you're just opening a directory ... and you're not writing into a file to write a file .. you can use the following 1- with replace the old file open(FILE,">$dir/filenamt.txt"); print FILE "Something Here"; close(FILE); 2- to write into a file with out replace it .. (with out rem

Re: Changing the path in @INC

2005-02-10 Thread bright true
Hi , i don't know if this would work ... but try it anyway BEGIN{ shift(@INC,"/sw/");} bye On Thu, 10 Feb 2005 06:29:26 -0600, Boysenberry Payne <[EMAIL PROTECTED]> wrote: > I know how to add to the perl path, but how do you take away. I have > the fink /sw/ path included in the @INC array

Re: Problem with script requiring valid referrer

2005-02-09 Thread bright true
Hi , have you tryed the script yourself ?? does it work with you ?? and with most of people ... if it doesn't work with some not all people .. then you don't have problem in your script .. ask those who can't use your form ... do they have a Firewall program such like ZoneAlarm if they do