Re: help in variable pattern matching

2007-12-19 Thread Roberto Etcheverry
Jin Zhisong wrote: > HI, I'm looking for some advice of how to do this? > > > > I need to match some "variable" pattenrs so > > > > I define a $match variable and use it in the patterr below. > > However it didn't match anything for the sample data. > > > > If I change the match critia to h

Re: Hi... Help regarding chdir

2007-12-19 Thread Roberto Etcheverry
It should work unless the user you are using to run the script doesn't have the rights to chdir to that directory. Ravindra Ugaji wrote: > Hi Monks, > I am trying the following code to change the directory > > chdir ( '/opt/application') || die ("Can't change directory: $!\n"); > tried this also >

Re: Multiple line parameters in parameter file

2006-09-29 Thread Roberto Etcheverry
This can be made with a regular expression: #!/usr/bin/perl #vim: set shiftwidth=2 autoindent showmatch syntax=perl use strict; use warnings; # all lines following __DATA__ go into $s my $s; { local $/ = undef; $s = ; } my %vars; # match 1 or more alphabetics chars followed by an '=' followed

Re: Fwd: loop nested foreach

2004-06-21 Thread Roberto Etcheverry
mike re-v wrote: Note: forwarded message attached. __ Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! http://promotions.yahoo.com/new_mail Subject: loop nested foreach Fr

Re: List as a value of a hash???

2004-06-21 Thread Roberto Etcheverry
Trina Espinoza wrote: Have a question regarding hashes. Lets say I wanted a list as one of the values in my hash for the reason that I would want to constantly push values into that list. .. $dataHash{"$fileName"}{count} = 1; $dataHash{"$fileName"}{increment} = push(@array,$fileNumber); ###PROBL

Re: Pattern match

2004-06-21 Thread Roberto Etcheverry
It's difficult to answer if you do not post the code with some input to test it, but lets suppose you have this: my @array; @array = ; # slurp whole file Then is easy to get what you want: my @lines_with_single_word = grep /^\s*\S+\s*$/,array; # ^\s*\S+\s*$ means beginning of line, 0 or more wh

Re: How to emulate a startup command from within a Perl script?

2004-06-17 Thread Roberto Etcheverry
Look for 'Playing with STDIN and STDOUT' and 'Re-Opening Files (dups)' in perlopentut . Wagner, David --- Senior Programmer Analyst --- WGO said the following on 6/16/2004 2:09 PM: I have a Perl process which runs on solaris under 5.8.3. It is started with the following command:

Re: Perl newbie: regexp

2004-06-17 Thread Roberto Etcheverry
This will do it: perl -n -e 'print if /Testing/m' test.txt '-p' prints every line in the file so you'll see the matching lines twice (one because of '-p' and the other because of 'print') and the non-matching lines once (because of '-p'). Look in 'perldoc perlrun' for differences on '-p' and '-

Re: Pattern matching \b

2004-06-14 Thread Roberto Etcheverry
[EMAIL PROTECTED] wrote: $field = "Search, This is part of the code."; ## We need to split by spaces. The issue is that the comma comes along. local(@words) = split('\s+', $field); foreach $word (@words) { if ($word =~ /Search/i) { $word =~ s/[,\]\)\}]\b//; $word =~

Re: splitting

2004-06-11 Thread Roberto Etcheverry
If you split the line like this: @seqs=split(/gi|37182815|gb|AY358849.1|/,$seq); It means the fields are separated by 'gi' or '37182815' or 'gb' or 'AY358849.1'. I don't think this is what you are looking for... From the previous post, it seems the file is separated by tabs, so 'gi|37182815|gb

Re: getting data

2004-06-11 Thread Roberto Etcheverry
Is this what you need? #!/usr/bin/perl use strict; # List of required columns separated by ', ', must match names in 'Fields:' my $req_fields = shift || 'Subject id, % identity, alignment length, mismatches, q. start, q. end'; # Split into array my @req_fields = split /, /, $req_fields; # Print he

Re: split a word after n-letters (regexp?)

2004-06-10 Thread Roberto Etcheverry
Stephan Hochhaus wrote: A question I assume can be answered using regexp, unfortunately I am just starting my way into it. I have a bunch of words that I want to split, so that the first letters (minus n) and the last n-letters are seperated. n is user defined and therefore not static. How can

Re: Importing external data into arrays

2004-06-09 Thread Roberto Etcheverry
PerlDiscuss - Perl Newsgroups and mailing lists wrote: I'm just a beginner to perl and am having some beginner type problems. I need to import a external file containing 15 character ID numbers (one per record) into an single dimensional array within perl. Later this array will be used to interroga

Re: Calling subs

2004-06-09 Thread Roberto Etcheverry
Werner Otto wrote: Hi All, How would I go about calling a sub from a script from another script. I am trying to call that sub just to get the values in my current script and then perform aditional logic, other than duplicating the process? Is this what you mean? file1.pl: #!/usr/bin/perl use st

Re: Storable Problem

2004-06-09 Thread Roberto Etcheverry
Anish Mehta wrote: Hello Everyone, I have a problem is getting some data from database. I am getting the error like this: Storable binary image v2.6 more recent than I am (v2.4) at blib/lib/Storable.pm (autosplit into blib/lib/auto/Storable/thaw.al) line 342, It seems that the entry at the db

Re: how to generate array name dynamically

2004-06-07 Thread Roberto Etcheverry
> hi all, > i hav a requirement wherein i hav to generate array name dynamically > durin recursive function cal how can i do this . > Why do you need to generate an array name? Can't you make it work using references? Because this way is, by far, less error-prone. > sid > --

Re: how to check for dots in filename

2004-06-07 Thread Roberto Etcheverry
> hi all, > can anyone tel me how to look for files which conatain dotsin it. > i.e > file1.txt > file2.txt > how to check for dots in filename using regular expression. > is it correct > > my $ty=polica.op > if($ty =m/ (.*)\.o/) The regular expresion should be /(.*)\.o/. Otherwise you'll tr

Re: using Mail::Sendmail

2004-06-04 Thread Roberto Etcheverry
[EMAIL PROTECTED] wrote: ok here it what I did and it is emailing sproadically. Also it is not placing the array data into the email body??? ## Set pragmas use strict; use Mail::Sendmail; ## Set and edit variables my $foreigntapes="/usr/local/log/foreign_tapes.log"; d

Re: unpack() help

2004-06-02 Thread Roberto Etcheverry
rmck wrote: Hi I have the .h file of a program that spits out a data file which is Binary Output. The binary file is a series of fixed length records. In C, each record has the format which is in the script. I thought I could use unpack to read the data, and I am having no success. PLEASE

Re: Request Tracker and HTML::FormatText

2004-05-29 Thread Roberto Etcheverry
Robert Citek wrote: > > On Saturday, May 29, 2004, at 09:03 US/Central, Roberto Etcheverry > wrote: > > The usual way to install modules is to run 'cpan': > > Here's a transcript of my cpan search: > > > # perl -MCPAN -e 'shell;' > Termina

Re: Request Tracker and HTML::FormatText

2004-05-29 Thread Roberto Etcheverry
ote: > > On Friday, May 28, 2004, at 16:29 US/Central, Roberto Etcheverry wrote: > > http://search.cpan.org/src/GAAS/HTML-Format-1.23/lib/HTML/FormatText.pm > > Thanks. I looked for that tar file and couldn't find one. So, I used > a wget to download the module: > >

Re: Request Tracker and HTML::FormatText

2004-05-28 Thread Roberto Etcheverry
Look in search.cpan.org. Sources are found at http://search.cpan.org/src/GAAS/HTML-Format-1.23/lib/HTML/FormatText.pm On Fri, 28 May 2004, Robert Citek wrote: > > Hello all, > > We are in the process of installing Request Tracker ( > http://www.bestpractical.com/rt/ -- rt.3.0.11 ) on a Fedora bo

Re: regex help

2004-05-28 Thread Roberto Etcheverry
On Fri, 28 May 2004, Andrew Gaffney wrote: > I'm trying to write a regex to parse the following data. Each group is a string > to parse. > > 05/28/04 > > Purchase With Pin Pin > > $10.00(pending) href='javascript: ShowHelp("PENDING TRANSACTION")'> border="0"> > $1,224.45 > > 05/27/04 > > Purc