David Buddrige wrote:
>
> Hi all,
Hello,
> I have a bunch of C++ source files that contain the string
>
> PCN: sometext
>
> where somtext is an arbitary sequence of characters.
>
> Whenever the text "PCN:" occurs, I want to remove it and everything else
> to the end of the line.
>
> To do th
Hi all,
Once again - I figured it out... here is the updated script:
while(<>)
{
my $current_line;
$current_line = $_;
$current_line =~ s/PCN:.*//g;
print $current_line;
}
It worked after I took out the square brackets - although I am not sure
why - since the square brackets *
Hi all,
I am really stuck. I am trying to install libapreq 1.0 but it doesen't
work because of the following errors. Why doesent't the package find the
apache-headers? Why does it need them? How can I make sure that they are
found? Can anyone help me?
Errors:
downloads/libapreq-1.0> make test
Colin Johnstone wrote:
>
> Gidday all,
Hello,
> In PHP if I want to add something to a string I do this
>
> $output = "";
>
> $output .= "A";
> $output .= "B";
> $output .= "C";
> $output .= "D";
>
> print $output;
>
> How do I do the same in PERL please.
That does the same thing in perl:
Hi all,
I have a bunch of C++ source files that contain the string
PCN: sometext
where somtext is an arbitary sequence of characters.
Whenever the text "PCN:" occurs, I want to remove it and everything else
to the end of the line.
To do this, I have written the following script:
while(<>)
{
this should do itperhaps someone can come up with a one liner
->cut
use IPC::Open3;
$CMD=join " ",@{ARGV[0..$#ARGV-1]}; #build up command
open3( local $TMP , \*RDRFH,local $TMP ,"$CMD"); #run it
open WR_FH, "> $ARGV[$#ARGV]" || die "could creat $ARGV[$#ARGV]: $!";
print WR_FH while ;
Let us know and maybe we can help.
Wags ;)
-Original Message-
From: Johnstone, Colin [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 19, 2002 21:26
To: '[EMAIL PROTECTED]'
Subject: RE: PERL String Manipulation
Gidday All,
Thank You for your help, I must have some other error that
Gidday All,
Thank You for your help, I must have some other error that I can't find.
Regards
Colin
The same way.
Wags ;)
-Original Message-
From: Johnstone, Colin [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 19, 2002 21:01
To: '[EMAIL PROTECTED]'
Subject: PERL string manipulation
Gidday all,
In PHP if I want to add something to a string I do this
$output = "";
$out
Gidday all,
In PHP if I want to add something to a string I do this
$output = "";
$output .= "A";
$output .= "B";
$output .= "C";
$output .= "D";
print $output;
How do I do the same in PERL please.
Thanking you in anticipation
Colin
On Monday 16 December 2002 12:21, Paul Kraus wrote:
Me and a co-worker created a whole project around the creation of an Excel
spreadsheet. From everything we looked around for there were no modules that
allowed insertion. There was a reason for that but I am not sure what that
reason is.
-
Thank You Toby and Mark for your help
Colin Johnstone
Website Project Officer
Corporate Website Unit
Public Affairs Directorate
ph 9561 8643
> -Original Message-
> From: Johnstone, Colin [mailto:[EMAIL PROTECTED]]
> Sent: Friday, December 20, 2002 11:55 AM
> To: '[EMAIL PROTECTED]'
> Subject: Reg ex help!
>
>
> Gidday All,
>
> Im reading course names in from a text file and want to
> remove the course number from the end
Is it always at the very end of the string?
If not, then are there any other numbers enclosed in parens in the course
names?
Probably the following should work:
$course =~ s/( \(\d+\)$//;
# removes a space followed by an '(' followed by 1 or more digits, followed
by ')' at the end of the string
F
Gidday All,
Im reading course names in from a text file and want to remove the course number from
the end of each course name. Can someone help me with the regex to do this.
e.g Mathematics 2 unit (15240)
to give me Mathematics 2 unit
Thanking you in anticipation.
Colin Johnstone
Webs
On Thu, 19 Dec 2002 17:44:22 +0100, "Jenda Krynicky" <[EMAIL PROTECTED]> wrote:
> From: [EMAIL PROTECTED]
> >
> > On Thu, 19 Dec 2002 11:04:27 -0500, [EMAIL PROTECTED]
> > wrote:
> > > But is it not
Shaunn Johnson wrote:
>
> --at this point, i'm still trying to figure out
> --how to find NEL. the ASCII chart says the following:
>
> DEC HEX OCT EDTTPU CHAR DESCRIPTION
> 10 00A 012 L/F CTRL-J LFline feed
> 13 00D 015 C/R CTRL-M CRcarriage
Hi
My sincere thanks go to all those who answered and are answering my
question about - passing array to a function.
This is my first time on a technical mailing list and so had trouble
expressing my questions.
I started PERL recently and am primarily from a C programming background.
My intentio
- Original Message -
From: "Paul Johnson" <[EMAIL PROTECTED]>
Newsgroups: perl.beginners
To: "Rob Dixon" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, December 19, 2002 7:19 PM
Subject: Re: Passing array to a function
> On Thu, Dec 19, 2002 at 03:45:56PM -, Rob Dixon wr
Satya Devarakonda wrote:
>
> Hi,
Hello,
> How can I pass an array to a function and get values back in it??? Here
> are excerpts from my code.
>
> sub getTimeInfo
> {
> my $sec = 0;
> my $min = 0;
> my $hour = 0;
> my $day = 0;
> my $mon
You're quite right Ed, it's safer to copy the parameters at the start of a
subroutine. Behind the scenes the parameter values are passed by reference,
so modifying @_ directly will change the value used as the actual parameter
in the calling code. Copying 'my @params = @_' will give you a local cop
"John W. Krahn" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Paul Kraus wrote:
>
> print "\e[120;72 G\e[120;43 G"
>
Of course. Thanks John.
/R
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Hmm. I presume you're using VMS? This is a platform-specific character set,
which is always a bit iffy in Perl. You could try setting the input record
separator to NEL by adding -0205 (those are both digit charater zeros) to
your command line. Your { chop; print; } two-liner will then work fine,
ex
Paul Kraus wrote:
>
> My UNIX system prints these print commands to printer to set font as
> well as page breaks ect... I need to be able to add them to my reports
> but just inserting them doesn't do the trick so I am guessing I need the
> actual ASCII codes to do it.
>
> Here is the text the wo
On Thu, Dec 19, 2002 at 02:32:15PM -0500, Paul Kraus wrote:
> When I run this code
>
> &buildexcel("Age");
> ...
> sub buildexcel{
> ...
> my $sheet=$book->worksheets('AgeRaw') if ($_[0] eq "Age");
> my $sheet=$book->worksheets('ReceiptsRaw') if ($_[0] eq "Cash");
Get rid of the "my"
Hi,
I'm trying this command from my perl program system ( "perldoc perldsc >
tmp.txt"). I don't see the output going to the file tmp.txt; instead it
shows the output
in the screen.How could I get the output in some text file.
Sugumar
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional
Correct me if I'm wrong group (I'm still a Perl novice myself), but
whenever one passes an argument to a subroutine, shouldn't one always
set local variables to $_[x]? Or at the very least add my @params = @_?
Paul: My suggestion is to add "my $param = $_[0];" as the first line of
sub buildexcel,
When I run this code
&buildexcel("Age");
...
sub buildexcel{
...
my $sheet=$book->worksheets('AgeRaw') if ($_[0] eq "Age");
my $sheet=$book->worksheets('ReceiptsRaw') if ($_[0] eq "Cash");
$sheet->activate();
...
}
I get this error
...
Can't call method "activate" on an undefi
On Thu, Dec 19, 2002 at 03:45:56PM -, Rob Dixon wrote:
> The proper way to return arrays from a function is to pass them by
> reference.
I don't know if I would go that far. There is nothing wrong with
returning a list from a function, but if the list gets too big (handwave
here) then you mi
I figured this out looking at posts on perlmonks.org.
Where are all of these application specific functions such as
usedrows-rows->{count} found?
> -Original Message-
> From: Paul Kraus [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, December 19, 2002 1:43 PM
> To: 'Perl'
> Subject: Excel
Is there a way using Win32::OLE to get the first row that doesn't have
data.
example...
A B C
1 data
2
I would want the script to return A2. I already now the column I want is
A.
Any ideas are places to look?
Paul Kraus
Network Administrator
PEL Supply Company
21
--thanks for the reply:
--at this point, i'm still trying to figure out
--how to find NEL. the ASCII chart says the following:
[snip]
DEC HEX OCT EDTTPU CHAR DESCRIPTION
10 00A 012 L/F CTRL-J LFline feed
13 00D 015 C/R CTRL-M CRcarriage ret
I think we may need to see your Perl code Shaunn. I've never heard of a NEL
character but that may be my ignorance; do you mean newline? How do you know
the control characters aren't being removed by what you've done?
chomp() will remove the last character from a string if it is the input
record s
Howdy:
I have a text file that I'm trying to use, but, it has control characters
at the end.
[snip]
test.txt: ASCII text, with very long lines, with NEL line terminators
[/snip]
I've tried to use 'sed' and 'tr' to remove NEL and just have
an ASCII text. I've even used dos2unix, but that doesn
From: "Paul Kraus" <[EMAIL PROTECTED]>
> Any ideas why this fails. If I remove if /aged/ and just have the if
> /Reports ... then everything works ok.
>
> Code
> #!/usr/bin/perl
> my @files;
> my %age;
> push (@files, glob "Aged*");
> push (@files, glob "Receipts*");
>
> foreach (@files){
>
From: "Paul Kraus" <[EMAIL PROTECTED]>
> ok I knew that :) for some reason I was thinking \s meant any white
> space that follows but it just means any 1 white space character
> without quantifiers.
>
> Ok so then why does this work
> if (/Report Total:\s+[\d,.]+/){
> print "\$&=$&\n";
> }
Paul, I would say it is your last \s+ which probably should be
written \s* which says there may or may not be whitespace after the last
number you find. With the plus there must be at least one white space.
Wags ;)
-Original Message-
From: Paul Kraus [mailto:[EMAIL PROTECTED]]
Se
Any ideas why this fails. If I remove if /aged/ and just have the if
/Reports ... then everything works ok.
Code
#!/usr/bin/perl
my @files;
my %age;
push (@files, glob "Aged*");
push (@files, glob "Receipts*");
foreach (@files){
open FILE,"<$_";
print "$_\n";
while(){
if (
Thank you very much.
I come from little bit of C program so was kind of suspcious.. So I am safe
using a reference created in a function.
Thanks again and regards,
Satya
ok I knew that :) for some reason I was thinking \s meant any white
space that follows but it just means any 1 white space character without
quantifiers.
Ok so then why does this work
if (/Report Total:\s+[\d,.]+/){
print "\$&=$&\n";
}
and this not work.
if (/R
From: "Paul Kraus" <[EMAIL PROTECTED]>
> Whats wrong with this regexpr?
>
> $string = "Report Total:2300,150.17
> 1352,768.15554,392.38277,186.72 84,321.84 31,481.08";
>
>
> if ($string=~ m/Report Total:\s
> ([\d,.]+)\
From: [EMAIL PROTECTED]
>
> On Thu, 19 Dec 2002 11:04:27 -0500, [EMAIL PROTECTED]
> wrote:
> > But is it not wrong to create an array in a function and send a
> > reference to the array back into the main function?
> >
> > Because the scope of the a
Whats wrong with this regexpr?
$string = "Report Total:2300,150.17
1352,768.15554,392.38277,186.72 84,321.84 31,481.08";
if ($string=~ m/Report Total:\s
([\d,.]+)\s
([\d,.]+)\s
([\d,.]+)\s
([\d,.]+)\s
([\d,.]+)\s
([\d,.]+)
A better (IMHO) implementation of VI is at http://www.vim.org. The Windows
version can be downloaded at ftp://ftp.vim.org/pub/vim/pc/gvim61.exe.
Enjoy!
-Original Message-
From: Dylan Boudreau [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 19, 2002 10:19
To: [EMAIL PROTECTED]
Subject
On Thu, 19 Dec 2002 11:04:27 -0500, [EMAIL PROTECTED] wrote:
>
> Thank you Sir,
>
> But is it not wrong to create an array in a function and send a reference
> to the array back into the main function?
>
> Because the scope of the array is limit
For you vi fans out there here is vi for windows
http://www.winvi.de/en/
-Original Message-
From: David T-G [mailto:[EMAIL PROTECTED]]
Sent: December 19, 2002 11:28 AM
To: perl beginners
Cc: Paul Kraus
Subject: Re: Editors
Paul, et al --
...and then Paul Kraus said...
%
% All great
Satya
I'm not sure why you're getting odd results - I ran the text of your post
under Perl (with no changes) and got
Satya - Dec19 20021219 "12/19/2002","Thursday",
Saty
Satya
I'm not sure why you're getting odd results - I ran the text of your post
under Perl (with no changes) and got
Satya - Dec19 20021219 "12/19/2002","Thursday",
Satya1 - Dec19 : 20021219 : "12/19/2002","Thursday",
which looks f
Hi,
How can I pass an array to a function and get values back in it??? Here
are excerpts from my code.
sub getTimeInfo
{
my $sec = 0;
my $min = 0;
my $hour = 0;
my $day = 0;
my $mon = 0;
my $year = 0;
my $IsDST = 0;
my $week_day = 0;
my @ti
Paul, et al --
...and then Paul Kraus said...
%
% All great info. Thanks.
It's good to see these every once in a while...
%
% This is a mail list of educated adults. We do not flame war over
Exactly. It is possible to state simple facts (like that vi is the only
editor everyone should ever
I will incorporate the for -> while change you suggest.With regard to parse
methods, I was intending to use the parse_csv subroutine suggested in Perl
Cookbook for parsing actual data. I have tested this out and it seems to
work just fine (having previously been caught out splitting CSV files).
I
From: "Rob Dixon" <[EMAIL PROTECTED]>
> "Jenda Krynicky" <[EMAIL PROTECTED]> wrote in message
> 3E01E02F.17624.1ED52A1C@localhost">news:3E01E02F.17624.1ED52A1C@localhost...
> > From: "Perl" <[EMAIL PROTECTED]>
> > > This should work (but beware - it is untested :)
> > >
> > > Rob
> > >
> > > my
"Jenda Krynicky" <[EMAIL PROTECTED]> wrote in message
3E01E02F.17624.1ED52A1C@localhost">news:3E01E02F.17624.1ED52A1C@localhost...
> From: "Perl" <[EMAIL PROTECTED]>
> > This should work (but beware - it is untested :)
> >
> > Rob
> >
> > my @required = qw(head1 head6 head8);
> > my $line;
From: "Perl" <[EMAIL PROTECTED]>
> This should work (but beware - it is untested :)
>
> Rob
>
> my @required = qw(head1 head6 head8);
> my $line;
>
> for ()
It's much better to use
while ()
This "for ()" forces Perl to read the whole file into an array
in memory. (Well ..
Thanks. I spoke to soon. The answer I found in the line feed thread.
Didn't work for this. But \c[ worked like a charm.
> -Original Message-
> From: Rob Dixon [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, December 19, 2002 8:40 AM
> To: [EMAIL PROTECTED]
> Subject: Re: ASCII Characters
>
Hi Paul.
These are ANSI escape sequences, with the square as the ASCII escape
character 0x1B. This is control-[, so you can code these strings in Perl as
"\c[[120;72 G" etc.
HTH,
Rob
"Paul Kraus" <[EMAIL PROTECTED]> wrote in message
013101c2a762$06dc2700$64fea8c0@pkrausxp">news:013101c2a762$06
Ignore. I just found my answer in the removing line feeds thread.
> -Original Message-
> From: Paul Kraus [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, December 19, 2002 8:25 AM
> To: 'Perl'
> Subject: ASCII Characters
>
>
> My UNIX system prints these print commands to printer to set fo
> -Original Message-
> From: David Buddrige [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, December 19, 2002 12:45 AM
> To: [EMAIL PROTECTED]
> Subject: Removing line-feed characters from a text file.
>
> ... How to determine the exact value of a non-printable character in a
> text file.
I
My UNIX system prints these print commands to printer to set font as
well as page breaks ect... I need to be able to add them to my reports
but just inserting them doesn't do the trick so I am guessing I need the
actual ASCII codes to do it.
Here is the text the would print if I redirected the rep
http:[EMAIL PROTECTED]/
Rob
"Ramprasad" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi all,
>
> Is there a FAQ digest of this newsgroup I can download and go through
>
> Thanks
> Ram
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additiona
Sorry - to check that the headers exist change the first part of the if()
statement to:
if ($line++ == 0)
{
my $i;
$column{$_} = $i++ foreach @field;
foreach (@required)
{
die "Column $_ doesn't exist"
This should work (but beware - it is untested :)
Rob
my @required = qw(head1 head6 head8);
my $line;
for ()
{
chomp;
my @field = split /,/;
my %column; # hash relating column header to column
index
next unless @field; # I
NAME
beginners-faq - FAQ for the beginners mailing list
1 - Administriva
1.1 - I'm not subscribed - how do I subscribe?
Send mail to <[EMAIL PROTECTED]>
You can also specify your subscription email address by sending email to
(assuming [EMAIL PROTECTED] is your email address):
Before working with lines in a csv file I would like to check the headers
from the file for accuracy i.e. do the headers I expect exist, and are they
in the right order.
Alternatively, and even better, I would like to check all headers I require
exist, then for each parsed line extract only extrac
Sorin Marti wrote:
> Hi,
>
> I can't find these modules on cpan:
>
> Apache::Request
> libapreq
http://search.cpan.org/author/JIMW/libapreq-1.0/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Hi,
I can't find these modules on cpan:
Apache::Request
libapreq
Where can I find them? I want to install Axkit (which works with Perl)
and it needs mod_perl
I installed it succesfully but a module named Apache::Request. This is
the error I get:
Can't locate Apache/Request.pm in @INC (@INC c
David Buddrige wrote:
>
> Hi all,
Hello,
> I have a bunch of C++ source files that have had form-feed characters
> inserted in them every so often. In vi and emacs these characters
> appear as ^L. I am wanting to write a short perl script that will pull
> out these characters; I am thiking of
67 matches
Mail list logo