Barry,
: I am trying to truncate a string so that it is only 39 characters long.
: The application is a label printing routine, and the label is only long
: enough to print 39 characters.
Wrong tool. Look for substr.
Joe
Joseph Discenza
Senior Analyst/Software Developer
1251 N. Eddy
We've been doing form filling using FDFs, using the FDF.pm. When Perl
5.8 came out, we couldn't quite make it work (I no longer remember any
specifics), but we could always instruct our clients to install Perl
5.6.
Now ActiveState has taken 5.6 down. Our sysadmin thought to try 5.10,
and in that
EwenMarshall wrote, on Tuesday, December 05, 2006 2:23 PM
: All I want to do is count the number of ;'s on each line of
: 15,000'ish lined text file. The first 3 lines look like
: (FINISH; is the end of 1 line):
:
: NEW ANALOGUE; A.PS.19.601; 0; 4;NA; 0;OFF;%;NO; 100.0;
:
[EMAIL PROTECTED] wrote,
on Wednesday, October 18, 2006 9:06 AM
What makes you think there'll still be
32-bit machines around in 2038. I'd expect to see them only in museums by
then--being used as paperweights, door-stops, etc.
Isn't that what they said in the 60s? "No way
Su, Yu (Eugene) wrote, on Monday, October 16, 2006 8:52 PM
: How to initialize an array? I want to get a median by using
: Statistics::Descriptive.
: I enter (12, 13, 14), (15, 16, 17), (16, 17, 18) I expect
: 13,16,17. Instead, I get 13.00, 14.50, 16.00.
:
: I thought my @temp_array=(); in the
Kevin Godden wrote, on Monday, October 16, 2006 10:21
AM
: saBound.cElements =
elementCount;
:
SAFEARRAY* pA = SafeArrayCreate(VT_I4, 1,
saBound);
While the loop is
protected by checking elementCount, the SafeArrayCreate call is not, so it is
almost surely the source of the error. Is it
Ewen Marshall wrote, on Thursday, September 07, 2006 2:18 PM
: my @date_time = localtime();
...
: my $mysql_today = $year-$month-$monthday; # Todays date in mysql
format
: my $mysql_minus1 = $year-$month- . (sprintf(%02d, $monthday - 1));
# yesterdays date in mysql format
I like the suggestion
Title: Regular expression question
Cai, Lucy (L.) wrote, on Monday, July 31, 2006 8:21
PM
: My
$file = "c:\temp\zips\ok.txt";
: How can
I split the $file to get the only path:
: My $dir
= "c:\temp\zips";: My $file = "ok.txt";
May I
suggest you use File:Basename instead of a regex?
Joe
Hello all,
I can't find anything in the doc about whether Perl's sort
function maintaining the order in equivalent subsequences. Suppose I have an
array of hashrefs that looks like this:
{name = 'a', status = 0}, {name = 'b', status
= 1}, {name = 'c', status = 1}, {name = 'd', status =
0}
Veli-Pekka Tätilä wrote, on Friday, May 05, 2006 12:34 PM
: I can't find anything in the doc about whether Perl's sort function
: maintaining the order in equivalent subsequences.
:
: Hi,
: You could take a look at:
:
: Perl\html\lib\sort.html
:
: To summarize V5.8 seems to be using the
Thomas, Mark - BLS CTR wrote, on Tuesday, April 11, 2006 10:28 AM
: $Bill Luebkert wrote:
: Rate RE2 RE5 RE3 RE4 RE1 RE1a
: RE2 136761/s -- -58% -61% -64% -74% -74%
: RE5 326584/s 139% -- -6% -14% -37% -37%
: RE3 347705/s 154% 6% -- -9% -33% -33%
: RE4 381098/s
Paul Rousseau wrote, on Friday, March 24, 2006 12:38 PM
:I am looking for help on a regex that examines strings such as
:
: xxxN yyy sssNNN
: xxxN yyyNyyy sss
: xxxN yyyNyyy ssN
:
: and returns only the sss part? N is always a numeral, and s
: is always alphabetic.
Does
Scott Purcell wrote, on Thursday, March 23, 2006 3:05
PM
: '^[a-zA-Z0-9-_.
]+$'
The others helped you get [] in
there. But hyphen (dash) has to be first, or it looks like a range operator. So
try:
^[-a-zA-Z0-9_.
\[\]]+$
Good
luck,
Joe
___
Title: RE: Perl Bug (again)
John Deighan wrote, on Fri 17-Feb-06 12:46
: my($nextID,$maxID) = @$L if $L;
:
: The parameter to getCached, $Customer, has a different value than
: during the first call. Because of that, the variable $L is undefined.
: What I expect the statement above to do is
Title: Yet another regex question
Ted Schuerzinger
wrote, on Thu 12-Jan-06 08:45: I have a text filewith lines like
this::: 1 (1) DAVENPORT, LINDSAY 3380.00 16 .00 49.00 USA .00: 2 (2)
CLIJSTERS, KIM 3206.00 17 .00 .00 BEL .00: [...]: 28 (28) MOLIK, ALICIA
671.00 15 .00 195.00 AUS .00:
Title: split() skipping trailing delimiters
DZ-Jay wrote, on Mon
05-Dec-05 07:58
: I have a
problem using the split() function: When there are trailing:
delimiters, without any content between them, split() skips them.
For
From "perldoc -f
split":
If
LIMIT is specified and positive,
Title: Counting matches
wrote, on Fri 11-Nov-05 11:06
: I have:: ...: $string ='EOS';:
Returns the offset of where the last m//g search left off for the variable in
question: ($_ is used when the variable is not specified). Note that 0 is a
valid match offset,: while undef indicates
Title: RE: spidering/crawling/scraping a site..
All,
I've gota dumped data
structure. I can print the string I dumped to:
$form_hash_ary_ref =
[
{
'desc' = 'Agreement to Provide
Insurance',
'name' =
'AGREE_PPI.pdf',
'copies' =
1,
'field_hash' =
{
'INS_POLICY_NUM' =
{
Title: RE: spidering/crawling/scraping a site..
All,
Please disregard. It was another
value not updating, and I've got it fixed. Thanks for your
attention.
Joe
==
Joseph P. Discenza, Sr.
Programmer/Analyst
mailto:[EMAIL
Title: How to sort these elements
Maxmelbin Neson (RBIN/EDM3) wrote, on Wed 26-Oct-05
06:50[snipped]
:
"/view/test.max2kor1/vobs/maxvob/satish.c@@/main/tmp_maxtest1/12"
:
"/view/test.max2kor1/vobs/maxvob/max.c@@/main/tmp_maxtest1/7" ,
:
Mike Fountain wrote, on Fri 10/21/2005 13:12
: There are several functions in the program, and
they fall into 8 basic categories. So, I've got one main file with the
main
:functions and then 8 other files with all
the other functions.
:
: The main file has this:
: use strict;
: use CGI
Title: Regex Newbie Q: Non-Trivial Substitution and Modifying the MatchedString
"Veli-Pekka Tätilä" wrote, on Sun 10/9/2005 15:58: Yet another newbie question about regular
expressions:: I'd like to find and replace bits of text as usual. However,
rather than: replace all occurrences in
Pierce, Glen E wrote, on Fri 10/7/2005 09:35
: This may seem like a simple
question, but I have a variable $month=7 but I want to represent it as
$month=07. How is this done.
$month = sprintf("%02d",
$month);
Good luck,
Joe
Title: Regex
David Budd wrote, on Tue 9/20/2005 10:57:
: I thought this was working, but my logs just showed a case
where it seems not to do what I want.: Why does::
$OK_body=($body=~/library\s*?card\D*?(\d{7})\D/i) ;: Not become true when
$body contains:: Library Card: 0240742
Probably
Title: Re: help with defined and !not defined
lorid wrote, on Fri 7/22/2005 10:27: my $a;: my $b;:: $b = 10;:: if
(defined $a){
All well and good; but in your
original post (which I no longer have available to quote, but I believe I recall
correctly), your $a (or equivalent) was the
John Deighan wrote, on Wed 7/13/2005 09:55
: We have a goto in our code. I hate it, but there
just isn't a good "switch" or "case" statement in Perl yet (I think I've heard
: that it's planned), and the following just isn't
efficient enough for us:: if ($op = 'thisop') {:
}: elsif ($op =
Title: RE: Using canned subroutines with includes - an answer of sorts
Doug Loud wrote, on Fri 7/8/2005 12:17
: in Windows XP Pro,
SP2, I have to use::: require 'includes/28ESP.pl';:: But in the
*NIX days, I used::: require "../includes/28ESP.pl";
Are you sure that isn't
require
Title: Re: Test if string is a number?
Chris Wagner wrote, on Thu 6/30/2005 08:48
: Wow there's been a lot of heavy duty code proposed to do
something so: simple. The answer is in how Perl converts between the
two.:: print "is a number" if $var eq $var + 0;: print "not a
number" if $var
Title: RE: Test if string is a number?
Chris Wagner wrote, on Thu 6/30/2005 12:41
: At 09:48 AM 6/30/05 -0500, Joe Discenza wrote:: Except
if $var is, say, '0.00'. Then $var + 0 is '0', and won't eq $var.:: 0.00
is not a valid internal representation of a number. That can only:
exist
Title: RE: Test if string is a number?
Chris Wagner wrote, on Thu 6/30/2005 14:41
: At 12:16 PM 6/30/05 -0500, Joe Discenza wrote:: I bet
you're right that "eval($var) eq $var + 0" works; have you: benchmarked
it against all the other (regex, e.g.) methods presented?::
Title: RE: mystery
Peter Eisengrein wrote, on Wed 6/29/2005 13:04
: Can someone tell me what's going on in my script? Here it
is:: : use strict;: use POSIX qw(INT_MAX);:
: my $i = INT_MAX;: my $n = INT_MAX - 1000;:
print("i = $i\n");: print("n = $n\n");: : : Not sure of
the *why*
Apurva Shukla wrote, on Tue 6/14/2005 09:28
:XYZ can be an 'Array of hashes' or a 'Single Hash':: Now if
I want to traverse all that is contained in XYZ I first read the array
length
:and then traverse it one by one.:: How can I get a length of
an array and in case its not an array I can
Title: restraining grep
Spencer_Lists wrote, on Fri 4/1/2005 02:34
: I have a few programs that accept user input as a series of
integer: values pairs separated by a delimiters between the pairs and
the: elements of the pairs. I previously made an array out of the first:
halves of the
Title: DBI handle as hash key
John Deighan wrote, on Fri 3/11/2005 09:14: I would like to use DBI handles as hash keys. I thought
that I'd read: somewhere quite a while ago that Perl was adding the
capability to use: non-scalar values as a hash key. However, when I
try $h-{$db} =
Title: IO::Socket::INET Handle problem
Julian Brown wrote, on Mon
3/7/2005 18:17
I do an accept on a listener socket.:
$new_sock = $listener-accept ();:: Then I create a hash reference to
store some state information:: $hashref = {:
'socket' = $new_sock,:
'otherstuff' = "really cool
Title: Variable in a repeating pattern?
Ben
Conrad wrote, on Tue 2/15/2005 15:00::
This works and gives me the first 3 chars of my string:: ($hoststr) =
$hostname =~ /(^\D{3})/;:: Is it possible to do this so I can make the
length of the repeating pattern: a variable? It's not working
Title: Scriptomatic 2 (Win32::OLE)
Chris wrote, on Thu
1/20/2005 09:59
: For those who haven't seen this yet, it was in today's
edition of Microsoft's TechNet newsletter. I didn't find it all that useful, but
maybe someone on this list will.:
[EMAIL PROTECTED]wrote,
on Mon 1/10/2005 06:53
: What I have is
:
: $string = my name is %name%, age
%age%, department %dept%;
:
: What I want is
:
: The % wrapped text returned to an
array like
:
: my @list =
GetVars($string);
:
: Anyone done something similar or
know how I could do
Lasher, Brian wrote, on Wed 12/15/2004
14:38: Is there any way to keep the
black command-prompt looking box from popping up when executing perl script on
win 32 platform?
Probably one of a hundred
replies: try wperl instead of perl.
Good luck,
Joe
Title: RegEx help
Jeff Williams wrote, on Tue 12/14/2004
11:23: I wrote a RegEx to let me know if a line of text
has exactly 36 commas init (the comma is the separator) and I came up with
this. I don't think itis quite right. I could use a little pointing in the
right direction.
Title: RE: Sorting question
Erich Beyrent
wrote, on Wed 12/1/2004 11:39: : I have the following data structure::
:: : $hash{$connid} = {"month" = $month,:
:
"day" = $day,:
:
"time" = $time,:
:
"user" = $user,:
:
"host" = $host,:
:
"from_ip" = $from_ip,:
:
};: :: :
Title: Sorting question
Apologies to the list if this isn't plain
text; my corp just switched to Exchange, and I can't force plain
text!
Erich Beyrent wrote, on Tue 11/30/2004
10:53: I have the following data structure:::
$hash{$connid} = {"month" = $month,:
"day" = $day,:
42 matches
Mail list logo