Re: Repeating Regexp

2002-11-28 Thread Jean Padilla
Hello, I suggest this: #!/usr/bin/perl -w use strict; my $var1 = "23456789"; my $var2; ($var2 = $var1) =~ s/(\d)/$1 /g; # only add 'g' for global substitution print "var1 = '$var1', var2 = '$var2'\n"; Regards. Paul Murphy a écrit : > > Hello, this is a two part question: a how to, and a how

Re: Extracting email adresses from a flat text file

2002-11-14 Thread Jean Padilla
try this: #!/usr/bin/perl -w use strict; my $if = "path_to_input_file"; my $of = ">path_to_output_file"; my ($name, $addr); open(IF, $if) or die "Can't open file $if for reading\n"; open(OF, $of) or die "Can't open file $of for writing\n"; while () { chomp; (undef,$name,undef,undef,undef,unde

Re: Understanding list creation...

2002-11-05 Thread Jean Padilla
Hi, the second line is simply declaring two variables: 1 - the scalar $itemtype 2 - the hash %symbol just another way to say my $itemtype; my %symbol; no magic here, *NOT* a list or data structure. A+ David Buddrige a écrit : > > Hi all, > > I am reading through a collegue's perl script. In it

Re: checking input syntax

2002-11-05 Thread Jean Padilla
Hi, try this : #!/usr/bin/perl -w use strict; sub Usage() { die "Usage: $0 \n"; } $_ = shift; Usage unless ((defined $_) && (/^server(\d+)\.(\w+)$/)); print "param is $_\n"; --- take a look at perlre. A+ Jose Malacara a écrit : > > I would like to be able to verify the presence and syntax of

Re: The basics of SWITCH

2002-11-04 Thread Jean Padilla
Hi, when you get $s from STDIN, it comes along with a newline, so try something like: chomp($s = ); A+ Gajo Csaba a écrit : > > Hi, I have a problem with SWITCH. I wrote this, I think > it's clear to anzone what it should do: > > print "Type in a number 1-5: "; > $s = ; > SWITCH; > { > if ($s

PDF to PS

2002-11-04 Thread Jean Padilla
Hi, all Do someone knows about a perl module to convert PDF files to postscript ? I'm working on several UNIX (AIX) boxes and want to 'automagically' print PDF files. Thanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: bad interpreter

2002-10-31 Thread Jean Padilla
Hi, try: which perl at the command prompt, it will reply something like /usr/bin/perl (the path to perl executable) then get sure the first line in checkit.pl is #!/usr/bin/perl -w or whatever the which command reply. Regards. Karin Friberg a écrit : > > Hi there! > > When I run my perl program

Re: Getting A File Name

2002-10-18 Thread Jean Padilla
Hi, try this : my $last = (glob("fred.*"))[-1]; --- - $last gets the last item in the array returned by glob() - glob() returns file names sorted alphabetically ;-) Regards. Ken Cole a écrit : > > Hi, > > I have a directory in which there are files such as: > > fred.1 > fred.2 > fred.3 > > T

Re: file to file copy

2002-10-16 Thread Jean Padilla
Hi, Christophe I suggest the following (see attached file: modcfg) Hope this helps. folschette a écrit : > > hi again, > and which i forgot to say: while merging file1 into file2 , no key should be > double, the right key is the one in file1!! > > so in fact it is a replacement of some lines i

Re: how to get the last line of a file

2002-10-11 Thread Jean Padilla
Hi, Alex i suggest the following: #!/usr/local/bin/perl -w my $filename = "Your_file_name"; # if you are so lucky to work on Unix my $lastline = `tail -1 $filename`; print $lastline; # if file is small enough to hold in an array open(FILE, $filename) or die "Can't open $filename.\n"; my @array

Re: Newbie Question

2002-10-10 Thread Jean Padilla
Hi, James Can you post some examples ? - what do you call the header in your files, - what string(s) are supposed to match what, - what is the data to write to output file(s) and so on... Rgds. James Parsons a écrit : > > Hi all > > Perl Is extremely new to me and I'm having a problem were to s

Re: Odd and even numbers

2002-10-09 Thread Jean Padilla
Hi, $num += $num % 2; this increments $num if $num modulo 2 is 1 (ie. if $num was odd) regards. "Zielfelder, Robert" a écrit : > > Greetings, > > I am trying to write a script that at one point needs to look at a number > and divide it by two. The results must always be an integer, but the

Re: I need help for handling text log file

2002-10-09 Thread Jean Padilla
Hi, I've downloaded Tie::File module from http://search.cpan.org/author/MJD/Tie-File-0.93/ and given it a little try : works fine. (even for me : Just Another Perl Newbie). Thanks, José. "NYIMI Jose (BMB)" a écrit : > > Why not just use Tie::File module ? > > http://search.cpan.org/author/JHI

Re: file handles!

2002-10-09 Thread Jean Padilla
Hi, pravesh 1 - You are saying "mv < > HI > I define a file the following way: > > $FILE_HANDLE = "< > then I openit > > open(FILEHANDLE); > > i perform some operations.. > > and then I want to transfer this "somefile" to some other directory > > but I am not able to use mv comand to do i

Re: I need help for handling text log file

2002-10-09 Thread Jean Padilla
Not an expert in perl (nor in english), but let's try ;-) if your output file is not supposed to get too big, consider 'writing' first your output lines in a hash ... $hash{1} = "line 1"; and so on (later, writing line 10 for eg.) if (whatever) { $hash{5} .= " these few words"; } when finished,

Re: Passing values through 2 different CGI scripts

2002-10-08 Thread Jean Padilla
If you are generating the email CGI form on the fly, you can pass the number as a hidden INPUT field : eg: ... INPUT fields as needed Hope it helps. Ben Crane a écrit : > > Hi List, > > I have an online web map created through mapinfo-when > you click on a part of the JPEG image it lo