Hi
open FILE, "file.txt" or die $!;
while ()
Sombody please tell me why do i get the message as below if i want to print
the contents of text file
Name "main::FILE" used only once: possible typo at nl.plx line3.
1:f:/file.txt
and my file is not executed (i did not get the output)
regards
Badr
i been doing perl long enough that you'd think i should know this, but one
thing i've never ever ever managed to get my head around is how regex works.
i'm using net::pop3 (mail::pop3client doesn't work!), and i'm trying to
extract certain data from the pop3 stream (from, subject, and some of th
badrinath chitrala <[EMAIL PROTECTED]> asked:
> open FILE, "file.txt" or die $!;
> while ()
>
> Sombody please tell me why do i get the message as below if i
> want to print the contents of text file
I would suggest you use the three argument open, i.e.
OPEN FILE, '<', $file or die "Can
"Dan" schreef:
> if (substr($line,0,5) eq "From:")
You don't even need to know that 'From:' is 5 characters, if you use
if ( 0 == index $line, 'From:' )
> i wrote a program some months back which utilised a compelx regex sub
>
> $onchan{lc($data[0])} =~ s/(,|^)\Q$data[1]\E(?=,|$)//;
>
> whic
badrinath chitrala wrote:
> Hi
Hello,
> open FILE, "file.txt" or die $!;
open() creates the filehandle FILE which is associated with the contents of
the file "file.txt".
> while ()
You are using a file glob to get a list of file names which is the same as
doing:
while ( defined( $_ = glob '
Hi:
I have a question about replacing $ sign when it is
before a digit. For example:
$str = "$1.12";
I want to extact the dollar amount 1.12 from $str.
If I do this:
$str =~ s/\$//;
$str then become .12. The "$1" in "$1.12" is
interpreted first before substitution is applied. How
do I prevent
Hi all, I need to get the modified date of a file on the server, the code I
have returns "Thu Jan 1 01:00:00 1970" even if I modify the file, so the
modified date doesn't change. I am using the following code:
open(HANDLE, $FILE);
my $date = localtime( (stat HANDLE)[9] );
Anyone know what
On Mon, 2006-08-05 at 08:07 -0700, Xuning Wang wrote:
> Hi:
>
> I have a question about replacing $ sign when it is
> before a digit. For example:
>
> $str = "$1.12";
use strict;
use warnings;
my $str = "\$1.12";
--
__END__
Just my 0.0002 million dollars worth,
--- Shawn
"For the th
On Mon, May 08, 2006 at 08:07:56AM -0700, Xuning Wang wrote:
> Hi:
>
> I have a question about replacing $ sign when it is
> before a digit. For example:
>
> $str = "$1.12";
>
> I want to extact the dollar amount 1.12 from $str.
>
> If I do this:
> $str =~ s/\$//;
>
> $str then become .12. Th
I am not sure whether anyone can help here.
I am building a gui for amongst other things ffmpeg and I seem to have
hit an issue with ffmpeg.
What I am trying to do is to run a ffmpeg command and then pass that
to a TextView in the main window.
ie:
$fh-> "ffmpeg -i somefile opts outfile"
which
Thanks for reply. The question is easily solvable if
it is in the same file as the perl script. You can use
single quotes or backslash to modify the string.
But as I stated in the message, the "$1.12" was in a
text file along with other things, say you have a
sentence like this in a file: Apple $
On Mon, 2006-08-05 at 08:35 -0700, Xuning Wang wrote:
> Thanks for reply. The question is easily solvable if
> it is in the same file as the perl script. You can use
> single quotes or backslash to modify the string.
>
> But as I stated in the message, the "$1.12" was in a
> text file along with
On 5/8/06, Xuning Wang <[EMAIL PROTECTED]> wrote:
Subject: Unsolvable? How to extract...
"Unsolvable?" There are many unsolvable problems in the world. Few of
them deserve to be posted to a beginners' discussion group.
I have a question about replacing $ sign when it is
before a digit.
It's
On Mon, May 08, 2006 at 08:35:52AM -0700, Xuning Wang wrote:
> Thanks for reply. The question is easily solvable if
> it is in the same file as the perl script. You can use
> single quotes or backslash to modify the string.
>
> But as I stated in the message, the "$1.12" was in a
> text file alo
On 5/8/06, Graeme McLaren <[EMAIL PROTECTED]> wrote:
Hi all, I need to get the modified date of a file on the server, the code I
have returns "Thu Jan 1 01:00:00 1970" even if I modify the file, so the
modified date doesn't change.
That sounds as if the stat() failed.
open(HANDLE, $FILE);
Try this:
open(FILE,"f:/file.txt") || print("open() failed as file did not exist.\n");
while (){
print $_;
}
Bedanta
-Original Message-
From: badrinath chitrala [mailto:[EMAIL PROTECTED]
Sent: Monday, May 08, 2006 2:46 PM
To: beginners@perl.org
Subject: print file
Hi
open F
It would probably be better to let the OS tell you why the open failed
by using the $! or $^E variables when you're checking why the open()
failed. It could be failing because the file was not found, or the file
could be locked somehow, or the user might not have read permissions on
the file.
Xuning Wang schreef:
> $str = "$1.12";
$str = '$1.12';
or
$str = q($1.12);
#!/usr/bin/perl
use strict;
use warnings;
while ()
{
print "$_\n" for /\$(\d+\.\d+)/g
}
__DATA__
Buy when the price goes from $1.12 to $0.98.
$12.345
$6
$7.8
$9.01
--
Affijn, Ruud
"Gewoon is een
Hi all,
I have an arry like this:
@arry=('AA bb','BB','CC AG')
How do I turn it into new array like this:
@new_array=('AA','bb','BB','CC','AG')
Thanks,
Li
__
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
htt
You could cycle through the array and use split() to split each element
by whitespace and then append the result to the @new_array array using
push();
-Original Message-
From: chen li [mailto:[EMAIL PROTECTED]
Sent: Monday, May 08, 2006 12:58 PM
To: beginners@perl.org
Subject: array qu
On Mon, 2006-08-05 at 12:58 -0700, chen li wrote:
> Hi all,
>
> I have an arry like this:
>
> @arry=('AA bb','BB','CC AG')
>
> How do I turn it into new array like this:
>
> @new_array=('AA','bb','BB','CC','AG')
Do you mean to break the elements on whitespace?
my @new_array = map { split } @a
On Mon, 2006-08-05 at 22:35 +0200, Dani Pardo wrote:
> On 5/8/06, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote:
>
> > Do you mean to break the elements on whitespace?
> >
> > my @new_array = map { split } @arry;
>
> Sorry but, can you explain the brackets? I just don't get it. Wich is
> the diff
>> It works fine for me:
>But you're cheating and not using my program! :-)
>If I comment out the "use warnings" in my program then it works as
>expected (at least, as *I* expected it to)
>--
>Steve Swift (aka "Swifty")
I used your program and it works for me in case:
$a=1
print $a
1
Maybe U
chen li wrote:
> Hi all,
Hello,
> I have an arry like this:
>
> @arry=('AA bb','BB','CC AG')
>
> How do I turn it into new array like this:
>
> @new_array=('AA','bb','BB','CC','AG')
my @new_array = split ' ', "@arry";
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMA
> > I have an arry like this:
> >
> > @arry=('AA bb','BB','CC AG')
> >
> > How do I turn it into new array like this:
> >
> > @new_array=('AA','bb','BB','CC','AG')
>
> my @new_array = split ' ', "@arry";
Both line codes work perfectly:
my @new_array = map { split } @arry;
or
my @new_array =
On Mon, 2006-08-05 at 15:15 -0700, chen li wrote:
> Both line codes work perfectly:
>
> my @new_array = map { split } @arry;
> or
> my @new_array = split ' ', "@arry";
The second statement will work perfectly if every element has only one
space character separating its components and has no lead
On Mon, May 08, 2006 at 07:07:14PM -0400, Mr. Shawn H. Corey wrote:
> On Mon, 2006-08-05 at 15:15 -0700, chen li wrote:
> > Both line codes work perfectly:
> >
> > my @new_array = map { split } @arry;
> > or
> > my @new_array = split ' ', "@arry";
>
> The second statement will work perfectly if
Mr. Shawn H. Corey schreef:
> chen li:
>> Both line codes work perfectly:
>>
>> my @new_array = map { split } @arry;
>> or
>> my @new_array = split ' ', "@arry";
>
> The second statement will work perfectly if every element has only one
> space character separating its components and has no leadin
On Tue, 2006-09-05 at 01:33 +0200, Paul Johnson wrote:
> Um, that's not quite correct.
>
> See `perldoc -f split` for details.
>
Oh, yes, a special case. I have long ago abandoned special cases since
they lead to errors. Note that `perldoc -f split` starts with:
split /PATTERN/,EXPR,LIMIT
s
Mr. Shawn H. Corey wrote:
> On Mon, 2006-08-05 at 15:15 -0700, chen li wrote:
>>Both line codes work perfectly:
>>
>>my @new_array = map { split } @arry;
>>or
>>my @new_array = split ' ', "@arry";
>
> The second statement will work perfectly if every element has only one
> space character separat
Hi,
I have a script that sorts the IDs with numerials first followed by alphas.
Everything works ok except that there are some IDs in the input file that are
duplicates. How can I "omit" and duplicate IDs
from the output file?
Below is my script and a sample input and output file generated fr
FlashMX wrote:
> Hi,
Hello,
> I have a script that sorts the IDs with numerials first followed by
> alphas. Everything works ok except that there are some IDs in the
> input file that are duplicates. How can I "omit" and duplicate IDs
> from the output file?
>
> Below is my script and a sample
Dan wrote:
i been doing perl long enough that you'd think i should know this, but one
thing i've never ever ever managed to get my head around is how regex works.
i'm using net::pop3 (mail::pop3client doesn't work!), and i'm trying to
extract certain data from the pop3 stream (from, subject, a
> Oh, yes, a special case. I have long ago abandoned special cases since
> they lead to errors. Note that `perldoc -f split` starts with:
>
> split /PATTERN/,EXPR,LIMIT
> split /PATTERN/,EXPR
> split /PATTERN/
> split
>
> Note: no strings. Strings do not work well when used as the patte
34 matches
Mail list logo