On Wed, 17 Jul 2024 17:41:22 +1000
Peter West via beginners wrote:
[...]
> $ cat print_file
> #!/usr/bin/perl -n
> while (<>) {
> print "$. $_";
> }
> exit;
[...]
> What happened to line 1?
It's eaten by the `while (<>) { ... }` loop that is wrapped around your
program because you used `-n` i
$ uname -a
Darwin Rosie.local 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:16:51 PDT
2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T8103 arm64
$ locale
LANG="en_AU.UTF-8"
LC_COLLATE="en_AU.UTF-8"
LC_CTYPE="en_AU.UTF-8"
LC_MESSAGES="en_AU.UTF-8"
LC_MONETARY="en_AU.UTF-8"
LC_NUMERIC="en_AU.UTF-8
Can you please answer this question?
http://stackoverflow.com/questions/28857025/perl-open-output-file-in-same-endianess-as-input-file-utf-16be-vs-utf-16le
When Perl opens an UTF-16 encoded file,
open my $in, "< :encoding(UTF-16)", "text-utf16le.txt" or die "Erro
On 17/05/2011 21:31, Chris Stinemetz wrote:
> I have an input csv file which data looks like the following:
>
>
> csno,svgrp,antfc,cdmanbr_list1.ncs_c,cdmanbr_list1.nghbrantf,cdmanbr_list1.pgn_c
> ,cdmanbr_list1.bandclass,cdmanbr_list1.anbeaplt,cdmanbr_list1.nghb_conf,cdmanbr_
> list1.hdhandoff
>
On 5/17/11 Tue May 17, 2011 2:01 PM, "Chris Stinemetz"
scribbled:
>> You show only '[1]' below. Do you want the '[1]' replaced by '[2]' in the
>> second record, '[3]' in the third record, etc.?
>
> Yes this was a mistake on my part. How you explain it in the previous
> statement is what I am t
> In the actual file, is the first record really spread out over three lines,
> or is that just the result of line-wrapping in your email message?
The first three lines can be omitted they will not be included in the input
file.
And yes it was wrapped by my email. Sorry about that.
&g
On 5/17/11 Tue May 17, 2011 1:31 PM, "Chris Stinemetz"
scribbled:
> I have an input csv file which data looks like the following:
>
>
> csno,svgrp,antfc,cdmanbr_list1.ncs_c,cdmanbr_list1.nghbrantf,cdmanbr_list1.pgn
> _c
> ,cdmanbr_list1.bandclass,cdmanbr_list1.anbeaplt,cdmanbr_list1.nghb_conf
Last correction
>
> csno,svgrp,antfc,cdmanbr_list1.ncs_c,cdmanbr_list1.nghbrantf,cdmanbr_list1.pgn_c
> ,cdmanbr_list1.bandclass,cdmanbr_list1.anbeaplt,cdmanbr_list1.nghb_conf,cdmanbr_
> list1.hdhandoff
> 871,0,1,871,2,0,1900,n,0,n
> 871,0,1,871,3,1,1900,n,0,n
> 871,0,1,872,1,0,1900,n,0,n
> 871,0,1
Correction
> u
> csno=871
> svgrp=0
> antfc=1
> cdmanbr_list1.ncs_c[1]=871
> cdmanbr_list1.nghbrantf[1]=2
> cdmanbr_list1.pgn_c[1]=0
> cdmanbr_list1.bandclass[1]=1900
> cdmanbr_list1.anbeaplt=n
> cdmanbr_list1.nghb_conf=0
> cdmanbr_list1.hdhandoff=n
> u
> EXIT
>
>
> u
> csno=871
> svgrp=0
> antfc=
I have an input csv file which data looks like the following:
csno,svgrp,antfc,cdmanbr_list1.ncs_c,cdmanbr_list1.nghbrantf,cdmanbr_list1.pgn_c
,cdmanbr_list1.bandclass,cdmanbr_list1.anbeaplt,cdmanbr_list1.nghb_conf,cdmanbr_
list1.hdhandoff
871,0,1,871,2,0,1900,n,0,n
871,0,1,871,3,1,1900,n,0,n
871
On 3/17/11 Thu Mar 17, 2011 12:26 PM, "Chris Stinemetz"
scribbled:
> Rob
>
> Not sure what I am doing wrong but when I incorporate the infile that I want
> to read and process the program does nothing and it seems like my PCMD file is
> never opened.
>
> Below is my code thus far.
>
> Thank
-Original Message-
From: Rob Dixon [mailto:rob.di...@gmx.com]
Sent: Thursday, March 17, 2011 10:37 AM
To: beginners
Cc: Chris Stinemetz
Subject: Re: input file
On 17/03/2011 15:56, Chris Stinemetz wrote:
>
> I'm trying to use file path for my file that I want to read but I a
On 17/03/2011 15:56, Chris Stinemetz wrote:
I'm trying to use file path for my file that I want to read but I am
getting the following error when trying to use strict.
Can't use string ("C://temp//PCMD") as a symbol ref while "strict
refs" in use at ./DOband.pl line 10.
Any help is greatly app
On Thu, Mar 17, 2011 at 11:56, Chris Stinemetz
wrote:
> I'm trying to use file path for my file that I want to read but I am getting
> the following error when trying to use strict.
>
> Can't use string ("C://temp//PCMD") as a symbol ref while "strict refs" in
> use at ./DOband.pl line 10.
>
> A
I'm trying to use file path for my file that I want to read but I am getting
the following error when trying to use strict.
Can't use string ("C://temp//PCMD") as a symbol ref while "strict refs" in use
at ./DOband.pl line 10.
Any help is greatly appreciated.
#!/usr/bin/perl
use warnings;
use
Hi Chap,
Chap Harrison wrote:
On Jun 4, 2009, at 8:10 PM, Raymond Wan wrote:
(Actually I dropped the whole idea when I decided to have the script
write the filtered results back into the clipboard -- which necessitated
hard-coding the path into the script anyway. Moreover, the whole thing
On Jun 4, 2009, at 8:10 PM, Raymond Wan wrote:
Chap Harrison wrote:
I've read perldoc perlrun but find it pretty confusing. Things
I've tried unsuccessfully are:
#!/usr/bin/perl /dev/clipboard
#!/usr/bin/perl < /dev/clipboard
#!/usr/bin/perl -- /dev/clipboard
The body of the script always be
On Thu, Jun 4, 2009 at 14:40, Chap Harrison wrote:
> I'm writing a collection of filters that read from the CygWin / Windows
> system copy buffer (/dev/clipboard) and write to STDOUT. I can certainly
> write Perl to open this "file" and read from it, but I wondered if there was
> a way to put it
Hi Chap,
Chap Harrison wrote:
I've read perldoc perlrun but find it pretty confusing. Things I've
tried unsuccessfully are:
#!/usr/bin/perl /dev/clipboard
#!/usr/bin/perl < /dev/clipboard
#!/usr/bin/perl -- /dev/clipboard
The body of the script always begins
while (defined (my $line = <>
I'm writing a collection of filters that read from the CygWin /
Windows system copy buffer (/dev/clipboard) and write to STDOUT. I
can certainly write Perl to open this "file" and read from it, but I
wondered if there was a way to put it into the shebang line. I don't
have any reason to w
>
> Your data is perfect for the paragraph mode* of readline:
>
Ahh, I forgot about paragraph mode.
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> my $user = shift;
> my $regex = qr/\A$user/;
>
> local $/ = '';
> while (my $record = ) {
> chomp $record;
> if ($record =~ /$
On Thu, Feb 19, 2009 at 22:42, wrote:
> I have a single input file with entries as follows:
>
> --snip--
> USER1 [20090101] note
> bla bla bla
> bla bla bla
>
> USER2 [20090104] note
> bla bla bla
> bla bla bla
>
> --snip--
>
> What I'm trying
pa...@compugenic.com wrote:
> I have a single input file with entries as follows:
>
> --snip--
> USER1 [20090101] note
> bla bla bla
> bla bla bla
>
> USER2 [20090104] note
> bla bla bla
> bla bla bla
>
> --snip--
>
> What I'm trying to do is
I have a single input file with entries as follows:
--snip--
USER1 [20090101] note
bla bla bla
bla bla bla
USER2 [20090104] note
bla bla bla
bla bla bla
--snip--
What I'm trying to do is create a single-argument script which displays
all entries for a given user.
So calling it as '
> -Original Message-
> From: Chas. Owens [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, April 09, 2008 13:05
> To: Wagner, David --- Senior Programmer Analyst --- WGO
> Cc: beginners@perl.org
> Subject: Re: Example of FTP w/o Input file? Is it possible to
> do or no
On Wed, Apr 9, 2008 at 3:55 PM, Wagner, David --- Senior Programmer
Analyst --- WGO <[EMAIL PROTECTED]> wrote:
snip
> No. I want to do a put of a file, but without having to write
> the file first
> and then doing put(Filein,fileout). I could write out the 60 plus files
> each time, but
> -Original Message-
> From: Chas. Owens [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, April 09, 2008 12:33
> To: Wagner, David --- Senior Programmer Analyst --- WGO
> Cc: beginners@perl.org
> Subject: Re: Example of FTP w/o Input file? Is it possible to
> do or no
On Wed, Apr 9, 2008 at 1:56 PM, Wagner, David --- Senior Programmer
Analyst --- WGO <[EMAIL PROTECTED]> wrote:
> I have a hash which contains for each entry the email which I
> need to ftp to a particular location with a specified name. I could
> write out the file and then do the ftp. Bu
I have a hash which contains for each entry the email which I
need to ftp to a particular location with a specified name. I could
write out the file and then do the ftp. But since I have the necessary
data in an audittrail report, I was wondering if I can ftp from a
variable using ftp comma
On 07/25/2006 08:32 PM, macromedia wrote:
Hi,
I can't seem to get my script to sort properly. [...]
Here is a shortened version of your program:
use strict;
use warnings;
use File::Slurp;
my %tags;
foreach my $line (read_file 'sort_tags.dat') {
if ($line =~ m/id=(\d*)([[:alpha:]]*)/) {
On 07/25/2006 10:07 PM, Mumia W. wrote:
On 07/25/2006 08:32 PM, macromedia wrote:
Hi,
I can't seem to get my script to sort properly. Below is my code [...]
sort { $a->[0] cmp $b->[0] || $a->[7] <=> $b->[7] }
[...]
"Cmp" does string comparisons. Use "<=>" for numeric
compar
macromedia wrote:
> Hi,
Hello,
> I can't seem to get my script to sort properly.
Yes, it is a bit tricky to get right.
> Below is my code along with
> a sample input.txt file. I also have what the output.txt file should look
> like. Also note any duplicate should be striped out
> which seems t
On 07/25/2006 08:32 PM, macromedia wrote:
Hi,
I can't seem to get my script to sort properly. Below
is my code [...]
sort { $a->[0] cmp $b->[0] || $a->[7] <=> $b->[7] }
[...]
"Cmp" does string comparisons. Use "<=>" for numeric
comparisons. Read "perldoc perlop".
--
Opps.
Once you save my code to a file the syntax woiuld be:
perl mycode.pl input.txt output.txt
Below is what I get now when I run my code on the input.txt file. As you can
see its not sorting the way I like. It should sort like the OUTPUT.TXT file
inmy previsou email.
Test.
Test.Test.Te
Hi,
I can't seem to get my script to sort properly. Below is my code along with a
sample input.txt file. I also have what the output.txt file should look like.
Also note any duplicate should be striped out
which seems to work ok.
Something is getting messed up when I have the numerials along
On Jan 7, 2004, at 12:42 PM, Steve Grazzini wrote:
On Jan 7, 2004, at 2:57 PM, drieux wrote:
But simply because there is no controlling
terminal does NOT mean that there is nothing on STDIN.
Were you reading that code backwards?
die usage() if @ARGV == 0 and -t;
# if ((THERE ARE NO FILENAMES
On Jan 7, 2004, at 2:57 PM, drieux wrote:
But simply because there is no controlling
terminal does NOT mean that there is nothing on STDIN.
Were you reading that code backwards?
die usage() if @ARGV == 0 and -t;
# if ((THERE ARE NO FILENAMES IN ARGV) &&
# (STDIN IS HOOKED UP TO A TERMIN
On Jan 7, 2004, at 10:37 AM, Steve Grazzini wrote:
[..]
I want to test whether STDIN (the default argument for -t)
is hooked up to the terminal (which is what -t tells you) so
that doesn't block waiting for user input.
[..]
I have absolutely no problem with the idea that
one wants to use '-t' to
On Jan 7, 2004, at 1:10 PM, drieux wrote:
On Jan 6, 2004, at 12:53 PM, Steve Grazzini wrote:
die usage() if @ARGV == 0 and -t;
You might not want to test if there is a
controlling terminal
I want to test whether STDIN (the default argument for -t)
is hooked up to the terminal (which is what -t te
On Jan 6, 2004, at 12:17 PM, [EMAIL PROTECTED] wrote:
[..]
It just dawned on me that I may not be using the
correct terminology since "pipe" and "STDIN" probably
imply much more than I mean for them to convey.
[..]
This is a good angst point to raise.
Technically STDIN|STDOUT|STDERR denote
merely
On Jan 6, 2004, at 1:07 PM, david wrote:
[EMAIL PROTECTED] wrote:
Case 3. (this is the difficult case for me) the script is invoked
with no file and no pipe to it. I would like the script to
end quietly, such as
test.input.source
Instead, it waits for input.
test.input.source
no command line a
[EMAIL PROTECTED] wrote:
>
> As I understand it, <> operator will open all items in @ARGV allowing
> one to do a shell command line of
>
>perl.script file1 file2 file3
>
> and inside perl.script you only need
>
> while (<>) { ... syntax to read all the files on the command line.
>
> <> wil
[EMAIL PROTECTED] wrote:
> Thanks for the help drieux.
>
> I could have been more explicit in my question to have stated that
> I want perl.script to exit quietly if there are no files on the
> command line or if not invoked as the recipient of piped output.
So what have you tried to adjust the c
[EMAIL PROTECTED] wrote:
> >So, 1. from within perl.script, how can one tell if the input stream is
> >coming from STDIN or a file that was opened by <>?
>
> Use select
>
> >2. If input stream is not coming from STDIN, but a file, how can one
> >tell which file is the current file (assuming multip
On Jan 6, 2004, at 3:17 PM, [EMAIL PROTECTED] wrote:
Case 3. (this is the difficult case for me) the script is
invoked with no file and no pipe to it. I would like the
script to end quietly
die usage() if @ARGV == 0 and -t;
I didn't show you how to check for the pipe (-p) because
this should pr
[EMAIL PROTECTED] wrote:
>
> Case 3. (this is the difficult case for me) the script is invoked
> with no file and no pipe to it. I would like the script to
> end quietly, such as
>>test.input.source
>>
>
> Instead, it waits for input.
>
>> test.input.source
> no command line args - switching t
t;STDIN" probably imply much more than I mean for them
to convey.
I hope this is more clear. And again, thanks for your help.
- Paul
-Original Message-
From: drieux [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 06, 2004 11:20 AM
To: Perl Beginners Mailing List
Subject: Re: Wh
>So, 1. from within perl.script, how can one tell if the input stream is
>coming from STDIN or a file that was opened by <>?
Use select
>2. If input stream is not coming from STDIN, but a file, how can one
>tell which file is the current file (assuming multiple files were
>specified on the co
From: [EMAIL PROTECTED]
> As I understand it, <> operator will open all items in @ARGV allowing
> one to do a shell command line of
>
>perl.script file1 file2 file3
>
> and inside perl.script you only need
>
> while (<>) { ... syntax to read all the files on the command line.
>
>
> <> wi
On Jan 6, 2004, at 9:32 AM, [EMAIL PROTECTED] wrote:
[..]
So, 1. from within perl.script, how can one tell if the input stream is
coming from
STDIN or a file that was opened by <>?
2. If input stream is not coming from STDIN, but a file, how can one
tell which file is the current file (assuming mul
As I understand it, <> operator will open all items in @ARGV allowing
one
to do a shell command line of
perl.script file1 file2 file3
and inside perl.script you only need
while (<>) { ... syntax to read all the files on the command line.
<> will also open STDIN if the perl script is invok
ople get a little annoyed when
they get multiple messages because you cross-posted.
-Original Message-
From: Bruce Ambraal
To: [EMAIL PROTECTED]
Cc: <
Sent: 3/16/02 9:17 AM
Subject: Adding the input file digits together (Come on guys)
Hi
I am want to add digits in In_digits together.
Hi
I am want to add digits in In_digits together.
Print total to screen.
Could someone help?
Thanx
Bruce
In_digits:
1,200
2,400
#!/usr/bin/perl -w
open(INPUT, "In_digits") || die;
open(OUTPUT, ">Out_digits") || die;
while () {
if (/(\d{1})(\,)(\d{3})/) {
print OUT
Hi
I am want to add digits in In_digits together.
Print total to screen.
Could someone help?
Thanx
Bruce
In_digits:
1,200
2,400
#!/usr/bin/perl -w
open(INPUT, "In_digits") || die;
open(OUTPUT, ">Out_digits") || die;
while () {
if (/(\d{1})(\,)(\d{3})/) {
print OUT
array
foreach (@inputarray) {print}
__EOF__
-Original Message-
From: Vitali [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 28, 2002 6:00 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: How to print firstly Raport page ,and after data from input
file
Dear friends!
Please
Dear friends!
Please consult me!
How I must change the code ,so that "Raport page" prints on the begining of
file,not in the end?
Code reads the lines,count $env and $page and print those to the report
page...
Thank you,
VItali Pokrovski
--
Here is
56 matches
Mail list logo