Edwards, Mark (CXO) writes:
>
> Either substr() or unpack(). unpack() is probable more efficient.
You should probably check before you make such statements. The
following code:
use strict;
use Benchmark;
my $count = 100;
my $data = "abcdefghijklmnopqrstuvwxyz";
timethese($count,
Terry,
You could loop the contents of the file and find the line you are
looking for...(i.e:
open(CURRENTFILE, "$source_directory/$file") or die "Cannot open $file: $!";
foreach $_ ( ) {
# do something like:
print "$_\n"; # to print each line
if ($_ =~ ) {
Title: RE: reading portions of a line from a file
; open your file
; loop through each line
$s="your huge string read from your open file";
$a_begin=5;
$a_end=10;
$b_begin=50;
$b_end=100;
$c_begin=280;
$c_end=300;
$a=substr($s,$a_begin,$a_end-$a_begin+1);
$b=
Either substr() or unpack(). unpack() is probable more efficient.
-Original Message-
From: Terry Franklin [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 03, 2001 10:14 AM
To: '[EMAIL PROTECTED]'
Subject: reading portions of a line from a file
All,
I am in need of doing the following
Terry,
You can grab each line and use pattern or substr operations.
eg:-
> positions 5-10, 50-100, and 280-300 in each line
replacing '## What would go here??' with:-
/.{4}(.{6}).{39}.({51}).{179}(.{21})/ && do {
@fields = ($1,$2,$3);
};
to give $fields[0] = positions 5-10 ...
or with:-
$f
All,
I am in need of doing the following in a perl/tk app i am writing ... I have
very large text files, about 300 characters per line, and thousands of lines
long.
I need to be able to assign variables to, for example, the characters in
positions 5-10, 50-100, and 280-300 in each line
There is
Hi,
I have a question about COM object creation with PerlScript.
I want to translate an example from the MSXML SDK from
JavaScript into Perlscript.
Here's the code:
my $xmlDoc = $WScript -> CreateObject ('Msxml2.DOMDocument');
$xmlDoc -> {async} = 'false';
$xmlDoc -> load('c:\some\nice.xml')
Hi,
I have a question about COM object creation with PerlScript.
I want to translate an example from the MSXML SDK from
JavaScript into Perlscript.
Here's the code:
my $xmlDoc = $WScript -> CreateObject ('Msxml2.DOMDocument');
$xmlDoc -> {async} = 'false';
$xmlDoc -> load('c:\some\nice.xml')