Joe wrote:
my $Num = 010233405560;
my @list = split/(..)/, $Num;
my $last = pop @list;
foreach (@list) {
print $_ is too big, must be 33 or less\n if $_ 33;
}
print $last is too big, must be 52 or less\n if $last 52;
Another way:
my @num = $Num =~ /(\d{2})/g;
my @max =
Here is how I got it to work, the print statements are just so I could
see what was happening:
#!/Perl -w
use strict
my $Num = 010233405560;
my @list = $Num =~ /\d\d/g;
my $i;
for ($i = 0; $i 5; $i++) {
#print \$list[$i]: '$list[$i]'\n; #NOTE: It's a 'string' here!
$list[$i] =~ s/^0//:
Jim Guion wrote, on Friday, June 18, 2004 11:57 AM
: NOTE: On my system, Windows2000 desktop running Cygwin, the original
: 'split' line had a 'blank' at the beginning of the array it returned!
Right! I didn't mention that. The blanks test as 0, and will always
be less than 33; I used pop to
Jim Guion wrote:
#print \$list[$i]: '$list[$i]'\n; #NOTE: It's a 'string' here!
$list[$i] =~ s/^0//: #Strips the leading zeroes!
#print \$list[$i] now: '$list[$i]'\n; #NOTE: Number now, good!
Wrong and completely unnecessary. Leading zeros have nothing to do with
whether it's a 'string'
That is what I thought, too. At some point, during my attempt to get it
all to work correctly, I was seeing it return true for 01 32, and I
can't reproduce it now. Well, whatever, I am now able to comment out
the substitution line and it works fine as you pointed out, Mark
Jim Guion
Sr.
I have two questions:
1. I open a CSV file and parse it. If it does not exist I
create it. Immediately after the
program I try to open the csv file with MS-Excel, it
gives error in reading.
2. How do I write and or append to the file in CSN format, an
array of values in a single column?
hi!
i'm writing a script which does some file copying and similar and have
stumbled upon two problems i thought will be easy but i didn't manage to
solve them on my own.
firstly, i have a file consisting of lines which contain certainf filter
instructions. like so:
last f:\centrale\n300\d*.asm
Greetings,
Suppose I have a string like
$sequence = [sas];
How can I get rid of the leading and trailing brackets and just have
$sequence = sas;
One way I thought of was :
chop($sequence);
reverse($sequence);
chop($sequence);
reverse($sequence);
This doesnt seem very clever. Can someone
[EMAIL PROTECTED] wrote:
I'm having a problem with my snippet below. The numbers
need to be under a certain size. There are 6 numbers in the
variable $Num 01 02 33 40 55 and 60. I need to
check if the first 5 numbers are below 33 and the last
number is 52 or less. The below snippet will return all
[EMAIL PROTECTED] wrote:
Greetings,
Suppose I have a string like
$sequence = [sas];
How can I get rid of the leading and trailing brackets and just have
$sequence = sas;
$sequence =~ s/\[([^]]+)\]/$1/g;
This will remove it.
Wags ;)
One way I thought of was :
chop($sequence);
Suchindra Sandhu [EMAIL PROTECTED] wrote:
Suppose I have a string like
$sequence = [sas];
How can I get rid of the leading and trailing brackets and just have
$sequence = sas;
One way I thought of was :
chop($sequence);
reverse($sequence);
chop($sequence);
reverse($sequence);
This
Hey,
We ran two builds with success. Here is what we did:
1. Downloaded the 810 source zip file from downloads.activestate.com
2. Extracted the source
3. Made sure that include was pointed to vc6.0/include and lib was
pointed to vc6.0/lib
4. Switched to the 810 extracted source and typed: nmake
Jeff Griffiths wrote:
What are you doing differently?
The big difference (I think) is that I'm using the MinGW (gcc) compiler.
I do also have VC 7 (Visual Studio .NET), and there's no problem for me
building perl with that compiler (and nmake), but for most of my
projects, a MinGW-built perl
Miha Radej wrote:
hi!
i'm writing a script which does some file copying and similar and have
stumbled upon two problems i thought will be easy but i didn't manage to
solve them on my own.
firstly, i have a file consisting of lines which contain certainf filter
instructions. like so:
Arms, Mike wrote:
Suchindra Sandhu [EMAIL PROTECTED] wrote:
Suppose I have a string like
$sequence = [sas];
How can I get rid of the leading and trailing brackets and just have
$sequence = sas;
One way I thought of was :
chop($sequence);
reverse($sequence);
chop($sequence);
hi.,
what is regular expression ? And in hash variable can get a key
through its value..?
Please clear me.. and point out me some good website on perl
programs and faqs
Thanks
// Ananthans //
Ananthan S wrote:
hi.,
what is regular expression ? And in hash variable can get a key
through its value..?
You can't get a key from a value as easily as you can get a value
from a key, but if your values are unique, you could do it be
reversing the hash. If you have
I need some help!
1. I open a CSV file and parse it. If it does not exist I
create it. Immediately after the
program runs, when I try to open the csv file with
MS-Excel, it gives error in reading. I am working on a windows box.
Here is the code:
my $csv = Text::CSV_XS-new({
18 matches
Mail list logo