On Fri, Apr 12, 2013 at 4:23 AM, kavita kulkarni
wrote:
> Thanks all, got many ideas from you..
>
> My script took ~7 min to run with data file of ~50,000 lines with
> substr()/unpack() enabled and same script took ~2 min after disabling
> substr()/unpack().
> ...
>
> For
On Fri, Apr 12, 2013 at 04:53:52PM +0530, kavita kulkarni wrote:
> Thanks all, got many ideas from you..
>
> My script took ~7 min to run with data file of ~50,000 lines with
> substr()/unpack() enabled and same script took ~2 min after disabling
> substr()/unpack().
No one has
rom thousand to millions of lines.
> If I use perl in-built function substr() to data extraction, it has huge
> impact on performance.
Compared to what?
> Is there any alternative for this?
Perhaps unpack() or regular expressions, but I doubt either would be
much faster, if at all.
--
Paul
On 12/04/2013 12:23, kavita kulkarni wrote:
Thanks all, got many ideas from you..
My script took ~7 min to run with data file of ~50,000 lines with
substr()/unpack() enabled and same script took ~2 min after disabling
substr()/unpack().
That led me to the conclusion that substr/unpack is
Thanks all, got many ideas from you..
My script took ~7 min to run with data file of ~50,000 lines with
substr()/unpack() enabled and same script took ~2 min after disabling
substr()/unpack().
That led me to the conclusion that substr/unpack is taking maximum of my
time (and that I should reduce
On 10/04/2013 16:45, Bob goolsby wrote:
G'Mornin' Kavita --
Before you go off on a goose chase, how do you know that substr() is going
to be a problem for you? Have you bench-marked it? If your file is as
large as you say, I strongly suspect that your bottleneck is going to be
I
p/ /g;
...
}
HTH, Ken
On Wed, Apr 10, 2013 at 8:02 AM, kavita kulkarni
wrote:
> Data file has the lines with same length and so the field positions I am
> interested in (so unpack works for me).
> Tried with "unpack" as well & it takes almost same time as substr().
>
> Here
On Wed, 10 Apr 2013 08:45:40 -0700
Bob goolsby wrote:
> Before you go off on a goose chase, how do you know that substr() is
> going to be a problem for you? Have you bench-marked it? If your
> file is as large as you say, I strongly suspect that your bottleneck
> is going to be
G'Mornin' Kavita --
Before you go off on a goose chase, how do you know that substr() is going
to be a problem for you? Have you bench-marked it? If your file is as
large as you say, I strongly suspect that your bottleneck is going to be
I/O and any differences between unpack()
Data file has the lines with same length and so the field positions I am
interested in (so unpack works for me).
Tried with "unpack" as well & it takes almost same time as substr().
Here is sample code:
Below function is called for each line of input data file..
sub extractFieldVa
From: timothy adigun <2teezp...@gmail.com>
> On 10 Apr 2013 11:30, "Chankey Pathak" wrote:
> >
> > Hi Kavita,
> >
> > You may try unpack (http://perldoc.perl.org/functions/unpack.html)
> >
> unpack would not work if the OP has varying length of lines.
Nope. It would work just fine as long as the
p://stackoverflow.com/questions/1083269/is-perls-unpack-ever-faster-than-substr
>
>
> On Wed, Apr 10, 2013 at 3:46 PM, kavita kulkarni
> wrote:
>
> > Hi All,
> >
> > I want to extract certain char sets (e.g. char 4 to 9, char 11 to 14
etc.)
> > from
Hi Kavita,
You may try unpack (http://perldoc.perl.org/functions/unpack.html)
Also read these: http://www.perlmonks.org/?node_id=308607,
http://stackoverflow.com/questions/1083269/is-perls-unpack-ever-faster-than-substr
On Wed, Apr 10, 2013 at 3:46 PM, kavita kulkarni
wrote:
> Hi All,
&g
Hi All,
I want to extract certain char sets (e.g. char 4 to 9, char 11 to 14 etc.)
from each line of my file and store them in separate variables for further
processing.
My file size can vary from thousand to millions of lines.
If I use perl in-built function substr() to data extraction, it has
On 07/09/2011 20:49, Emeka wrote:
On Wed, Sep 7, 2011 at 8:00 PM, Rob Dixon wrote:
On Wed, Sep 7, 2011 at 8:08 PM, Emeka wrote:
On 06/09/2011 13:04, Emeka wrote:
Could someone explain what Perl does behind here?
Assign to Substring..
substr($string, 0 , 5) = 'Greetings';
W
Hi Emeka,
On Wed, 7 Sep 2011 20:49:44 +0100
Emeka wrote:
> Rob,
>
> Which C file should check out?
>
> Emeka
>
Please look at the function definition starting from «PP(pp_substr)» in pp.c in
the Perl 5 distribution:
https://github.com/mirrors/perl/blob/blead/pp.c
It seems pretty complicate
gt; On 06/09/2011 13:04, Emeka wrote:
>>
>>>
>>> Could someone explain what Perl does behind here?
>>>
>>> Assign to Substring..
>>> substr($string, 0 , 5) = 'Greetings';
>>>
>>
>> What do you want to know Emeka?
>>
>> T
Rob,
I want to check out the C code. Kindly mail it to my box.
Have a great day!
Emeka
On Wed, Sep 7, 2011 at 8:00 PM, Rob Dixon wrote:
> On 06/09/2011 13:04, Emeka wrote:
>
>>
>> Could someone explain what Perl does behind here?
>>
>> Assign to Substr
On 06/09/2011 13:04, Emeka wrote:
Could someone explain what Perl does behind here?
Assign to Substring..
substr($string, 0 , 5) = 'Greetings';
What do you want to know Emeka?
There is no copy of the 'old' string, and substr behaves as documented.
I have the C code of s
On 11-09-06 08:32 AM, Emeka wrote:
I asked what Perl does behind.. Is it an alias or what? I want internal
detailsor something technical.
See `perldoc -f substr` and search for /lvalue/.
--
Just my 0.0002 million dollars worth,
Shawn
Confusion is the first step of understanding
On Tue, Sep 6, 2011 at 1:19 PM, Shawn H Corey wrote:
> On 11-09-06 08:04 AM, Emeka wrote:
>
>> Hello All,
>>
>> Could someone explain what Perl does behind here?
>>
>> Assign to Substring..
>> substr($string, 0 , 5) = 'Greetings';
>&
On 11-09-06 08:04 AM, Emeka wrote:
Hello All,
Could someone explain what Perl does behind here?
Assign to Substring..
substr($string, 0 , 5) = 'Greetings';
Regards,
Emeka
It replaces the first 5 characters in $string with 'Greetings'.
#!/usr/bin/env perl
use stric
Hello All,
Could someone explain what Perl does behind here?
Assign to Substring..
substr($string, 0 , 5) = 'Greetings';
Regards,
Emeka
--
*Satajanus Nig. Ltd
*
On Sat, 28 Nov 2037 10:04:37 +0800, billy wrote:
> when i user substr,i find "Tab" key is calculated as 1,but i want to set
> it as 8,what will i do? thks.
Tab doesn't mean a fixed space between the content before and after it on
a line. If you want that, use spaces inste
From: "Bill Harpley"
> My Comment: this is an obvious approach, with numerous advantages.
> However, it requires installation of the BD:Oracle module, which can be
> very tricky.
> Basically, I started to install and configure all of this (Perl,
> DBI,DB:Oracle) on HP-UX 11.31 but after 4 days I
eft-aligned to the field, except for
> one column.
> ...
"Why do you write the SQL query results into a text file only to have to
parse them out later? Run the SQL from the Perl script via DBI and you
will not need any substr().
Jenda"
=
My Comment: this is an obvious
eld, except for one
> column.
> ...
Why do you write the SQL query results into a text file only to have
to parse them out later? Run the SQL from the Perl script via DBI and
you will not need any substr().
Jenda
= je...@krynicky.cz === http://Jenda.Krynicky.cz =
When it comes to
the output of the SQ query, the right-aligned colum looks
like this:
NODE_UL
=
146
281
985
So both the data and Field Title are right-aligned to the column.
I am using a function cal of the form:
$field_value=substr( $input_line , $field_start, $field_width ) ;
Where
query, the right-aligned colum looks
like this:
NODE_UL
=
146
281
985
So both the data and Field Title are right-aligned to the column.
I am using a function cal of the form:
$field_value=substr( $input_line , $field_start
Bobby wrote:
"John W. Krahn" <[EMAIL PROTECTED]> wrote: Bobby wrote:
Bobby wrote:
open EXCLUDE, '<', $exclude_psc or die "Could not open
'$exclude_psc' $!";
while ( ) {
next if $. == 1; # exclude header
chomp;
my ($excpsc,$keyword) = split /\|/;
%ex_psc = (exclpsc=>$excps
printing to
out file. Thanks.
$newpsc = substr($PSC,0,$count);
if (uc($ex_psc{exclpsc}) eq uc($newpsc)){
$_= join '|',$base_no,$ex_psc{exclpsc},$ex_psc{exkeyword};
print OUT;
You are assigning to the hash so it will only contain data from the
last record in the 'excl
That works, thanks Tom!
Tom Phoenix <[EMAIL PROTECTED]> wrote: On Thu, Mar 6, 2008 at 8:31 AM, Bobby
wrote:
> Use of uninitialized value in concatenation (.) or string at generatePsc.pl
> line 48, line 5.
Is this what you seek?
next unless defined $PSC;
It can also be quite educational
On Thu, Mar 6, 2008 at 8:31 AM, Bobby <[EMAIL PROTECTED]> wrote:
> Use of uninitialized value in concatenation (.) or string at generatePsc.pl
> line 48, line 5.
Is this what you seek?
next unless defined $PSC;
It can also be quite educational to use the Perl debugger to step
through a pr
CTED]> wrote: Bobby wrote:
> Could someone please tell me what's wrong with my use of the
> substr function below? I keep on getting "use of uninitialized
> value in substr". Thanks.
>
> $newpsc = substr($PSC,0,$count);
>
> Here's the complete
Below is what i get when i tried to print just the $PSC variable. So the $PSC
column has the value of (PSC, FCSD2, ADEK1, ADEZ2). I did put in a check for
alphanumeric in $PSC if ($PSC =~ /^[a-zA-Z0-9]+$/) before doing the substr but
still have same issue.
What i'm trying to do is to
On Wed, Mar 5, 2008 at 11:57 PM, Richard Lee <[EMAIL PROTECTED]> wrote:
snip
> Also, can you explain why below is wrong?
snip
> func([EMAIL PROTECTED]);
> sub func {
> my $aref = shift;
> my $oref = "$aref"; # WRONG <- why is it wrong?
> }
*What not just like below? As long as you have unique key, it would
retain all the information.*
$ex_psc{"$excpsc"} = "$keyword";
$ex_psc{"$excpsc"} is superfluous because *all* hash keys are strings.
perldoc -q quoting
What’s wrong with always quoting "$vars"?
John
Thank you
Richard Lee wrote:
open EXCLUDE, '<', $exclude_psc or die "Could not open
'$exclude_psc' $!";
while ( ) {
next if $. == 1; # exclude header
chomp;
my ($excpsc,$keyword) = split /\|/;
%ex_psc = (exclpsc=>$excpsc,exkeyword =>$keyword );
*What not just like below? As lo
open EXCLUDE, '<', $exclude_psc or die "Could not open
'$exclude_psc' $!";
while ( ) {
next if $. == 1; # exclude header
chomp;
my ($excpsc,$keyword) = split /\|/;
%ex_psc = (exclpsc=>$excpsc,exkeyword =>$keyword );
*What not just like below? As long as you have unique
Bobby wrote:
Could someone please tell me what's wrong with my use of the
substr function below? I keep on getting "use of uninitialized
value in substr". Thanks.
$newpsc = substr($PSC,0,$count);
Here's the complete code:
#!/usr/bin/perl
use strict;
use warnin
[..snip..]
>
> while () {
> my ($base_no, $name, $description, $PSC) = split
> /\|/;
>
Are you absolutely sure that $PSC is getting a value
here? If you "print $PSC" do you get a value? It
might also help to see the data stream...
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additio
Sorry, i've left out some details in my previous email. I've isolated the code
and it works without the substr function. Thanks in advance for any
suggestions.
Bobby <[EMAIL PROTECTED]> wrote: Could someone please tell me what's wrong with
my use of the substr func
Could someone please tell me what's wrong with my use of the substr function
below? I keep on getting "use of uninitialized value in substr". Thanks.
$newpsc = substr($PSC,0,$count);
Here's the complete code:
#!/usr/bin/perl
use strict;
use warnings;
my $exclude_psc = &
On 7/6/07, elavazhagan perl <[EMAIL PROTECTED]> wrote:
While executing the mutate.pl pgrogram,the diagnostic msg obtained as
"Use of uninitialized value in substr at mutate.pl line 31, line 1."
I almost defined all the variables. Would you kindly provide some remedy to
thi
Hai
While executing the mutate.pl pgrogram,the diagnostic msg obtained as
"Use of uninitialized value in substr at mutate.pl line 31, line 1."
I almost defined all the variables. Would you kindly provide some remedy to
this……
This is the mutate
David Gilden wrote:
> I am not sure I have the syntax quite right here, any suggestions would be
> welcome.
>
> $line = "Friday, June 23, 2006 12:30 PM" ;
>
> $last_updated = substr($line, 0, (length($line) -9)); # remove the time
> part of time stamp
> # the a
David Gilden wrote:
> Hello,
Hello,
> I am not sure I have the syntax quite right here, any suggestions would be
> welcome.
>
>
> $line = "Friday, June 23, 2006 12:30 PM" ;
>
> $last_updated = substr($line, 0, (length($line) -9));
> # remove the time par
On 6/25/06, David Gilden <[EMAIL PROTECTED]> wrote:
I am not sure I have the syntax quite right here, any suggestions would
be welcome.
You can find the syntax for substr, as with any of Perl's built-in
functions, in the perlfunc manpage. You should be able to use this
comma
On Sun, Jun 25, 2006 at 01:16:13PM -0500, David Gilden wrote:
> Hello,
>
> I am not sure I have the syntax quite right here, any suggestions would be
> welcome.
>
>
> $line = "Friday, June 23, 2006 12:30 PM" ;
>
> $last_updated = substr($line, 0, (lengt
Hello,
I am not sure I have the syntax quite right here, any suggestions would be
welcome.
$line = "Friday, June 23, 2006 12:30 PM" ;
$last_updated = substr($line, 0, (length($line) -9)); # remove the time part of
time stamp
# the above line is throwing an error
Thx,
Dave Gil
All,
I need to search a file for a string then set a variable using substr b/c
it is at a certain position, then finally replace the string with another
string.
Here is my test code:
my $gpg=qq(/home/gpghrp/.gnupg);
open (GPG, "gpg --finger
Edward Wijaya wrote:
Seems that John's regex approaches are (much) faster:
Rate HD_string HD_jkrahn2 HD_jkrahn1
HD_string 203251/s -- -18% -76%
HD_jkrahn2 247033/s22% -- -71%
HD_jkrahn1 848840/s 318% 244% --
[snip]
sub h
n = length ($a);
my $num_match=0;
for (my $i=0; $i<$len; $i++) { # assume that the lists are of same
length
++$num_match if substr($a, $i, 1) eq substr($b, $i, 1);
}
#my $weight = $num_match/$len;
return $num_match;
}
sub hamming
From: "John W. Krahn" <[EMAIL PROTECTED]>
> Peter Scott wrote:
> > In article <[EMAIL PROTECTED]>,
> > [EMAIL PROTECTED] (Edward Wijaya) writes:
> >
> >>BTW, can you explain what's the difference between these two?
> >>
> >>>sub hamming_distance_string { ( $_[0] ^ $_[1] ) =~ tr/\0// }
> >
> > In
Peter Scott wrote:
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Edward Wijaya) writes:
BTW, can you explain what's the difference between these two?
sub hamming_distance_string { ( $_[0] ^ $_[1] ) =~ tr/\0// }
In a scalar context, tr/// returns the count of the number of
characters seen.
sub
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Edward Wijaya) writes:
>BTW, can you explain what's the difference between these two?
>
>>
>> sub hamming_distance_string { ( $_[0] ^ $_[1] ) =~ tr/\0// }
In a scalar context, tr/// returns the count of the number of
characters seen.
>> sub hamm
Thanks so much for the reply John,
On Mon, 03 Jan 2005 04:07:05 -0800, John W. Krahn <[EMAIL PROTECTED]> wrote:
I don't know if I am a master but I wouldn't use a regular expression.
In my eyes, you certainly is a master!
BTW, can you explain what's the difference between these two?
sub hamming_di
From: "Octavian Rasnita" <[EMAIL PROTECTED]>
> If you can use substr(), use it, because it works much faster than
> regexp.
>
> Teddy
Nope. One substr() will of course be quicker than one regexp
application, but a loop containing substr() will most of the time
slowe
Edward WIJAYA wrote:
Dear friends,
Hello,
After a couple of months dwelling into Perl scripting especially in
manipulating strings, I found myself resorting to use "substr" function
a lot.
I had a feeling that the most of the "substr" function can be replaced
with rege
If you can use substr(), use it, because it works much faster than regexp.
Teddy
- Original Message -
From: "Edward WIJAYA" <[EMAIL PROTECTED]>
To:
Sent: Sunday, January 02, 2005 5:08 PM
Subject: Choosing between Regexp and Substr
> Dear friends,
>
> After a
Dear friends,
After a couple of months dwelling into Perl scripting especially in
manipulating strings, I found myself resorting to use "substr" function a
lot.
I had a feeling that the most of the "substr" function can be replaced
with regexp in any cases. For example t
On Saturday, Oct 30, 2004, at 21:46 US/Central, [EMAIL PROTECTED] wrote:
My earlier post was not quite clear. I will explain my problem in
detail here.
I have a string whose length is say 5. I need to copy another string
into this string but from an offset of 10.
I tried using substr but this is a
f 10.
> I tried using substr but this is a limitation of substr and it gave me
> a fatal error.
> Is there any other function, method which will allow me to do so ?
>
> Manas.
Yes, "rindex" is what (I think) you want; here is a small example of its use:
my($ne
My earlier post was not quite clear. I will explain my problem in
detail here.
I have a string whose length is say 5. I need to copy another string
into this string but from an offset of 10.
I tried using substr but this is a limitation of substr and it gave me
a fatal error.
Is there any
[EMAIL PROTECTED] wrote:
Hi All,
Hello,
I need to copy a substring in a string which is completely out of the
primary string (in terms of the offset). substr does not allow me to do
so.
Do you mean like this:
$ perl -le' $_ = q/abc/; substr( $_, 20 ) = q/def/; print'
substr outside of st
Hi All,
I need to copy a substring in a string which is completely out of the
primary string (in terms of the offset). substr does not allow me to do
so. Is there any other way in which I can do that ?
Thanks,
Manas.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail
tured, and all the others remove all the $DIGIT
variables.
If you do:
for (split /\n/, $EDM_nonactive_tapelist) {
print "$1\n" if !/\*Orig/ and /st_9840_acs_0/ and /\((E\d+)/;
}
The problem you're having with substr() is that the third argument is the
LENGTH of the substring
All,
can anyone provide some help?
my current output is
E00854), Seq #: 000595 in TLU: st_
and all I want is the E string and cannot get my substr working
Here is my code:
foreach (split /\n/, $EDM_nonactive_tapelist ) {
if (( /\((E\d+)/ ) && ( !
umns from 1:
@rows = sort { substr($a, 20, 5) cmp substr($b, 20, 5)
|| substr($a, 49, 10) cmp substr($b, 49, 10) } @rows;
If you're numbering columns from 0, adjust the offsets above.
The general concept for multi key sorting is to combine the comparisons with
a logical &quo
?
This should work:
my @sorted = map substr( $_, 15 ),
sort
map substr( $_, 20, 5 ) . substr( $_, 39, 10 ) . $_,
@unsorted;
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED
Jeff Westman wrote:
Hi,
I need to do a sort on a couple of column ranges.
I want to be able to do a primary sort, on say, columns 21-25 and
then a secondary sort on columns 40-49.
Any ideas on how to approach this?
TIA
/j
__
Do you Yahoo!?
Yahoo!
Jeff Westman wrote:
I need to do a sort on a couple of column ranges.
I want to be able to do a primary sort, on say, columns 21-25 and
then a secondary sort on columns 40-49.
Any ideas on how to approach this?
Yes.
1. Check out the docs for the sort() function.
2. Check the Perl FAQ:
perldoc
Hi,
I need to do a sort on a couple of column ranges.
I want to be able to do a primary sort, on say, columns 21-25 and
then a secondary sort on columns 40-49.
Any ideas on how to approach this?
TIA
/j
__
Do you Yahoo!?
Yahoo! Mail - You ca
Luke Bakken wrote:
>
> From: Larry Sandwick [mailto:[EMAIL PROTECTED]
> >
> > I have a scripted I wrote that uses *substr* on a file that has fixed
> > fields. I have to parse the file before I upload into MYSQL.
> >
> > Is there a more efficient way other than
> -Original Message-
> From: Larry Sandwick [mailto:[EMAIL PROTECTED]
>
> I have a scripted I wrote that uses *substr* on a file that has fixed
> fields. I have to parse the file before I upload into MYSQL.
>
> Is there a more efficient way other than *substr*, I l
Larry Sandwick wrote:
>
> I have a scripted I wrote that uses *substr* on a file that has fixed
> fields. I have to parse the file before I upload into MYSQL.
>
> Is there a more efficient way other than *substr*, I looked a *pack* and
> *unpack* . it did not make any sense to
> > Is there a more efficient way other than *substr*, I looked a *pack* and
> > *unpack* . it did not make any sense to me.
Unpack is what I would use. Perldoc unpack.
$item = substr($the_line,0,10);
$ldesc= substr($the_line,11,40);
$page = substr($the_lin
I have a scripted I wrote that uses *substr* on a file that has fixed
fields. I have to parse the file before I upload into MYSQL.
Is there a more efficient way other than *substr*, I looked a *pack* and
*unpack* . it did not make any sense to me.
Here is my code, and any suggestions
On Sep 29, [EMAIL PROTECTED] said:
>I got it to work after adding a new var in apache modperl environment.
>
>This works:
> $acct_no = $xgi->param("acct_no");
> print substr($acct_no, 0, 4, "x" x (length($acct_no)-4));
>
>This did NOT work:
> p
I got it to work after adding a new var in apache modperl environment.
This works:
$acct_no = $xgi->param("acct_no");
print substr($acct_no, 0, 4, "x" x (length($acct_no)-4));
This did NOT work:
print substr($xgi->param("acct_no"), length($xgi->param(&
234 which shows only the last four.
>>
>>I know how to use the substr but what about replacing the preceding values
>>with ?
>
>You could use a regex:
>
> $string = "1234567890";
> $string =~ s/.(?=.{4})/x/g;
You could also use:
$string =~ s/(.*)(.{4}
On Sep 26, [EMAIL PROTECTED] said:
>Does anyone have a short routine for displaying mask on some values and
>displaying the value of the last four? For example, alot of site display
>credit card numbers like 1234 which shows only the last four.
>
>I know how to use the substr
Does anyone have a short routine for displaying mask on some values and
displaying the value of the last four? For example, alot of site display
credit card numbers like 1234 which shows only the last four.
I know how to use the substr but what about replacing the preceding values
with
On Sat, Nov 28, 2037 at 10:04:37AM +0800, billy wrote:
> when i user substr,i find "Tab" key is calculated as 1,but i want to set it as
>8,what will i do?
> thks.
I'm not sure what you mean.
Are you saying you want to replace the tab character with 8 spaces?
In tha
Hi, billy,
2002-11-28 10:38:19
I think change s to s will be a great help.
=== At 2037-11-28, 10:04:00 you wrote: ===
>when i user substr,i find "Tab" key is calculated as 1,but i want to set it as 8,wha
when i user substr,i find "Tab" key is calculated as 1,but i want to set it as 8,what
will i do?
thks.
James Edward Gray II wrote:
> If you have fixed width values, separated by spaces and with no spaces
> in the values, you could use the super simple:
>
> @list_of_values = split ' ', $fixed_width_line;
No, unfortunately i do have spaces in values. Felix suggestion seems the
right way to do it
On Sep 4, zanardi2k2 said:
>I extract data from an AS/400 table, and i am not able to get a decent
>CSV format. So i have to choose a fixed-width format. Now i have to get
>all values. Is there something better than:
>
>$var1=substr($_, 0, 10)
>$var2=substr($_, 11, 16)
>$
o in my spare time, so i am
> sorry if my question is about a very simple thing.
>
> I extract data from an AS/400 table, and i am not able to get a decent
> CSV format. So i have to choose a fixed-width format. Now i have to
> get
> all values. Is there something better than:
>
on Wed, 04 Sep 2002 16:00:06 GMT, Zanardi2k2 wrote:
> Is there something better than:
>
> $var1=substr($_, 0, 10)
> $var2=substr($_, 11, 16)
> $var3=...
See
perldoc -f pack
perldoc -f unpack
If you have e.g. the following layout:
my $string = "12
something better than:
$var1=substr($_, 0, 10)
$var2=substr($_, 11, 16)
$var3=...
to do this?
Thank you in advance.
--
Zanardi2k2
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
ue in substr at ./outlook-grabber.pl line 232.
And line 232 looks like:
for ($cnt=0; $cnt")
{
$ignore = 2;
}
}
return $newtext;
}
--- End Message ---
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
"Lance Prais" <[EMAIL PROTECTED]> writes:
> if (substr($line, 42, 7) eq'"Running"') #if statment to see if "Running" is
if (substr($line, 42, 7) eq "Running" )
Because you had single quotes, you were looking for the string
&qu
From: Frank Newland <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: substr and =~ as one liner
Date sent: Tue, 27 Nov 2001 11:55:32 -0600
> How can I express the following two lines as a
How can I express the following two lines as a one liner?
===
$left_trim = substr($_,85,13);
$left_trim =~ s/^\s+// ; ## Remove leading spaces
===
tia
frank
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Whoops,
the first time I sent this it still had a part in it that needs a subdir
called dnb. i took that outof this and tested it again.
And while i was there, I made one more change as a sanity check,
where I had first used
my ($formfill, $formfill1, $formfill2, $formfill3);
to declare and
arch_company_name, "\n";
print STDOUT "formfill3 = ", $formfill3, "\n";
print STDOUT "formfill2 3x = ", $formfill2, $formfill2, $formfill2, "\n";
print STDOUT "formfill1 follows ", "\n";
print STDOUT $formfill1, "\n";
pr
t;$search_company_name";
$formfill2 = join "", "&st=", "$search_state", "&city=", "$search_city";
$formfill1 = join "XX", $formfill3, $formfill2;
print STDOUT "co name = ", $search_company_name, "\n"
[EMAIL PROTECTED]>
To: "Craig S Monroe" <[EMAIL PROTECTED]>; "Beginners@Perl (E-mail)"
<[EMAIL PROTECTED]>
Sent: Wednesday, June 27, 2001 5:45 PM
Subject: Re: substr (help,help,help);
> > while (){
> > if (m/\/nic\/login/){
>
> this just say
On Wed, Jun 27, 2001 at 05:30:11PM -0400, Craig S Monroe wrote:
> open (SOURCE, "< $filename");
>
> while (){
> if (m/\/nic\/login/){
> substr ($_,28,4);
> print;
> }
> }
That substr is a no-op, meaning it does nothing. If warnings had been
turned on
1 - 100 of 109 matches
Mail list logo