Hi John
I think you need to tell us something more. You say you
my @parts = ("one", "two", "three");
substr($parts[1],0,0) = ".";
print "@parts";
works fine. (Unless you really /did/ miss the closing quote from 'three'?).
May we see a little more of your code?
Don't forget that, i
In a similar way, a GIF file has either 'GIF87a' or 'GIF89a' the first six bytes
(depending whether it's the 1987 or the 1989 standard) followed by the screen
width (in pixels) in the next two bytes, followed by the screen height in the
two after that.
Cheers,
Rob
> -Original Message-
John
What you're doing looks OK, but it's my guess that either the user name doesn't
start at the beginning of the line or the state doesn't finish at the end, i.e.
you have leading or trailing spaces but have anchored your pattern to the ends
of the string.
Try
foreach (
" ro
Hi Christopher.
Don't know about a WWW mirror, but here's my solution to your problem.
my @data = qw(L54 L61 dKa dRz);
foreach (@data)
{
my ($prefix, $value) = m/(.)(.+)/;
print "Prefix: $prefix\n";
print "Value: $value\n";
print "\n";
}
Sorry
Hi Ruthie
I presume you're writing a module rather than a simple script?
There are two ways around this: you can do what it says, and give it an explicit
package name. For instance, if you're writing perl/lib/Local/Package.pm you can
refer to it as
Local::Package::@ISA
throughout. The othe
Hi Jorge
This does what you want, and I think is fairly straightforward. The line 'local
$/' temporarily undefines the record separator for the scope of the enclosing
block, so that the read on the next line pulls in all of the file. (I assume
your files aren't any bigger than you showed us?)
It's really easy using the LWP packages. For instance:
use LWP::Simple;
getstore ('http://www.perl.org/Images/title.gif', 'title.gif');
will fetch you a camel.
Cheers,
Rob
> -Original Message-
> From: ss98 [mailto:[EMAIL PROTECTED]]
> Sent: 05 September 2001 04:47
> To: [EM
assigned in the order of the open bracket within the regex.
HTH,
Rob
> -Original Message-
> From: Weaver, Charles [mailto:[EMAIL PROTECTED]]
> Sent: 05 September 2001 13:37
> To: 'Rob Dixon'
> Subject: RE: Parse file
>
>
> Hello, I know I was not the intend
That's really easy as long as the array is the /only/ thing you want to pass.
my @array = qw(one two three four five);
printarray (@array);
sub printarray
{
print "@_";# parameter list passed as built-in array @_
}
If, however, you need to pass the array togethe
{
strcat (command, a[i]);
}
system (command);
exit (0);
But there may well be a better way.
Cheers,
Rob
> -Original Message-
> From: Sutapalli, eswara [mailto:[EMAIL PROTECTED]]
> Sent: 06 September 2001 13:23
> To: 'Rob Dixon '
> Subj
Sorry (again) that should be 'char *a[]'
R
> -Original Message-----
> From: Rob Dixon [mailto:[EMAIL PROTECTED]]
> Sent: 06 September 2001 13:04
> To: Sutapalli eswara; 'Rob Dixon '
> Cc: Beginners@Perl. Org
> Subject: RE: Reg passing arguements
Hi JandR
You're right, the Perl chdir command changes your current effective directory
but doesn't change what 'pwd' reports.
use Cwd;
is what you want. This provides its own 'cwd' and overloads 'chdir' to keep the
PWD environment variable (and, of course, the return from 'cwd') in sync.
H
What is the error Deepak?
Don't you mean
$url -> query_form( 'dataReceived' => '2000', 'Area' => '24' );
???
Rob
> -Original Message-
> From: D.Gupta [mailto:[EMAIL PROTECTED]]
> Sent: 06 September 2001 15:33
> To: [EMAIL PROTECTED]
> Subject: To send data from perl script to HTM
pt will look for the two parameters, find
neither of them, and leave data1 and data2 blank. Your response will therefore
be empty.
HTH,
Rob
> -Original Message-
> From: D.Gupta [mailto:[EMAIL PROTECTED]]
> Sent: 06 September 2001 16:09
> To: Rob Dixon
> Subject: Re: To send
You haven't been using printf correctly. Try
foreach (qw(
1000.000
10.000
100.000
1.000))
{
printf "%13.6f\n", $_;
}
The %13.6 gives a total field width of 13 and 6 decimal places. Same as C. The
default is to r
> ppm install Storable
Rob
> -Original Message-
> From: Rajeev Rumale [mailto:[EMAIL PROTECTED]]
> Sent: 17 September 2001 06:10
> To: [EMAIL PROTECTED]
> Subject: Urgent !!! installing Storable.pm
>
>
> Hi,
>
> I need to install and use the Storable.pm in my machine. I am useing
You may need
>
> $string =~ /\s+(\S+)\s+/;
>
if you could have mnore than one whitespace character delimiting the field.
Rob
> -Original Message-
> From: John Edwards [mailto:[EMAIL PROTECTED]]
> Sent: 07 September 2001 09:20
> To: 'Thaddeus Robertson'; [EMAIL PROTECTED]
> Subject: R
ailed in require at
> c:\inetpub\wwwroot\cgi-bin\RecruitWings\testing\storeable.pl line 18.
> BEGIN failed--compilation aborted at
> c:\inetpub\wwwroot\cgi-bin\RecruitWings\testing\storeable.pl line 18.
>
> --------
>
Now /that/ I didn't know. (About the ' I mean.)
Thanks Paul.
> -Original Message-
> From: Paul Johnson [mailto:[EMAIL PROTECTED]]
> Sent: 07 September 2001 11:44
> To: agc
> Cc: perl
> Subject: Re: &' meanning
>
>
> On Fri, Sep 07, 2001 at 06:33:23AM -0400, agc wrote:
> > what does &ex
Erm, I'm not clear what you're trying to do Veeraraju.
Firstly you're opening your file for append, so a read on the file won't return
any data.
Secondly you're not using the result of the substitution. While this may well be
a cut-down example I hope you're not expecting the file itself to be m
Hello Bruce
Take a closer look at the docs, and try
my $xml = XMLin($data, SuppressEmpty => undef);
HTH,
Rob
Bruce Ferrell wrote:
I have a wee problem I can seem to solve. I don't want to get into
should XML::Simple be used, it's not relevant to my question... I don't
think. Below is so
t.
Bruce
On 01/30/2010 04:16 AM, Rob Dixon wrote:
Hello Bruce
Take a closer look at the docs, and try
my $xml = XMLin($data, SuppressEmpty => undef);
HTH,
Rob
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/
Hi Bob
I suggest you forget about regular expressions and use the library
function split() instead. Take a look at the code below.
HTH,
Rob
use warnings;
use strict;
my (@ukchecksum, @uktrackname);
open my $bhf_file, '<', '/home/bob/tmp/md5music'
or die "Could not open md5music: $!";
Why are you replying to me? My post did use the three-argument form of
open(). Also:
- It is bad form to use upper case letters for lexical variables
- Passing / / as the first parameter of split() will split on the first
single space in the string. It is better to use ' ' instead which
dis
Bob Williams wrote:
"Uri Guttman" wrote:
"BW" == Bob Williams writes:
BW> Hi Rob, Many thanks. That does what I want :) Now I need to study
BW> your code to learn why.
and you need to learn to bottom post. you wrote one line and quoted 80
lines which have already been seen by others. goo
Chris Coggins wrote:
I posted a question to this list yesterday from the google groups
interface, asking for help with the following. I have since tried to
post additional details in replies to that message using the google
groups site and none of my posts have shown up on the list so let's try
Erik Lewis wrote:
I've got a large text file that I'm trying to parse some fields from. I'm using substr to pull the
first field and that is working just fine, now I'm trying to print the values between 2 irregular
delimiters in this case a "^UT" and a "^". I'm matching it with m/ but I
do
120 wrote:
On Mon, 2010-02-22 at 11:06 +1000, Dave Tang wrote:
On Fri, 19 Feb 2010 22:58:24 +1000, 120 wrote:
Apologies for my error - if I may point out that sending 'off list'
replies is also equally rude.
May I ask about this netiquette? I usually thank people who have helped me
"off l
Uri Guttman wrote:
It's generally considered very rude - but the world is full of rude
arseholes. Many of them can be found on the perl list.
which perl list? there are many. do you include yourself as you are on
this list? do you actually help people here (don't recall seeing you in
many thr
raphael() wrote:
use strict;
use warnings;
use Data::Dumper;
my @links =
({
name1 => 'http://www.abc.com/data/a/000/name1.txt',
name2 => 'http://www.abc.com/data/a/000/name2.txt',
});
for my $element ( @links ) {
for my $name ( sort keys %$element ) {
print "$name --> ${$element
raphael() wrote:
My BAD :(
THERE IS NO FIRST ELEMENT IN A HASH!!
PLEASE FORGIVE ME. I AM IN A THICK OF EVERYTHING TODAY.
LET ME REPHRASE --
HOW DO I LOOP OVER THE ANONYMOUS HASH WHICH IS INSIDE AN ARRAY?
use strict;
use warnings;
my @links =
({
name1 => 'http://www.abc.com/data
Shlomi Fish wrote:
... WxWidgets has wxGlade ...
Does it? Thanks Shlomi I am very fond of Wx and didn't know about this.
Rob
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/
jbl wrote:
I am having trouble with a regex in perl.
I have an array that looks like this:
Abilene,KS,67410,1019 2000 Ave,38.88254,-97.20204,Grant Town Fire Dist
*Arlington,KS,67514,100 W Main St,Reno County Fire Dist 4
Abilene,KS,67410,1463 3325 Ave,39.079136,-97.1181,Sherman Township
Fire Distr
On 22/05/2010 15:22, Akhthar Parvez K wrote:
On Saturday 22 May 2010, Jim Gibson wrote:
On 5/21/10 Fri May 21, 2010 12:13 PM, "Akhthar Parvez K"
scribbled:
Jim, thanks for your continued help.
Jim, forget everything that I "scribbled" upto now, how would you
tell Perl to pick 'cd' of 'abc
On 04/06/2010 12:55, Chaitanya Yanamadala wrote:
use strict;
use warnings;
my $string = 'WIDTH="1986" HPOS="573" VPOS="3003">';
my ($id) = $string =~ /ID="(.*?)"/;
print $id;
__END__
HTH,
Rob
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: b
On 10/06/2010 03:17, Peng Yu wrote:
I can't find an existing perl subroutine (in the library) to find
every occurrence of a substring in a string. The following webpage
"Example 3b. How to find every occurrence" uses a loop to do so. But
I'd prefer a subroutine. Could you let me know if such a su
On 27/06/2010 18:08, marcos rebelo wrote:
Hi all
This time, it's much more a personal opinion than a recipe.
http://sites.google.com/site/oleberperlrecipes/recipes/01-variables/04---misc/01-when-shall-we-use-default-variables
Opinions are always welcome in perl-reci...@googlegroups.com
IMO t
On 20/07/2010 16:22, Chandan Kumar wrote:
Hi ,
Small confusion about word boundaries. word boundaries matches
anything between non-word character and word character ,right.
Not quite. /\b/ matches any (zero-length) point in a string between a
word and a non-word character, or between a word c
Speed of execution is the last goal of all.
First of all make your program functional and intelligible.
Only after that, if you have problems with resources (including time,
disk space, or processor) tune it to be more efficient.
HTH,
- Rob
--
To unsubscribe, e-mail: beginners-unsubscr...@
[EMAIL PROTECTED] wrote:
Hi,
I want to push XML data file to the XML channel, please find the code
snippet for the same.
#!/usr/bin/perl
use LWP::UserAgent;
my $browser = LWP::UserAgent->new;
my $url = 'http://xxx.xxx.xxx.xxx:x';
open(FILE,"display.xml");
my @data=;
Sharan Basappa wrote:
>
Thanks everybody. I need to use these as a part of algo I am working
on. I will get back if I have any comments ..
Rotating an array and calculating a factorial are both likely to absorb
large amounts of processor time unless your problem is trivial. I'm also
intrigued t
Gowri Chandra Sekhar Barla, TLS, Chennai wrote:
>
Hi
John thanks for replay, script is working fine
I am unable to understand following expression
s!/\*.*?(?:\*/|$)!!,
[snip]
Gowri, and everybody, /please/ bottom-post your replies to this list.
This has been getting out of hand recently, and
Kashif Salman wrote:
>
I know I can create html code using CGI and call a subroutine in there
easily but if i were to use a here document for my html code, can I
call a subroutine in there?
print<
Yes you can, but I'd rather not tell you how because it's likely to be
the ugliest of several poss
John Sampson wrote:
Hello -
I am trying to accumulate items in a flat list (array) by
concatenating on to it
the scalars contained in arrays which in turn are contained in arrays. The data
is to be read in from a file rather than existing as literals in my code.
Everything I try either crashes
Richard Lee wrote:
John W. Krahn wrote:
Richard Lee wrote:
While reading 'mastering perl', I run into @- and @+ for the first time.
perldoc perlvar
Trying to understand what's going on, I ran the code from the book, but
$-[1] and $+[1] shoudln't match only the first match? (in this case,
Richard Lee wrote:
Rob Dixon wrote:
Perhaps it would help to think of the offset as being the index of the
points between the characters, so the start of the string is at offset
zero, after 'a' (and before 'b') is at offset one and so on. Then can
you see how offset 7 is be
Ken Foskey wrote:
I am extracting addresses from an XML file to process through other
programs using pipe delimiter the following code works but this is going
to get 130,000 records through it it must be very efficient and I cannot
follow the documentation on the best way to do this.
After this
JBallinger wrote:
>
On Mar 14, 3:26 pm, [EMAIL PROTECTED] (Manoj) wrote:
>>
When using Data: Dumper is taking more time for my 1 lines of CSV file.
This solved a few queries...and the benchmark was a new value addition for
me. Thanks
2) Is there any optimal method for reading a CSV fi
Ken Foskey wrote:
On Tue, 2008-03-18 at 00:55 +1100, Ken Foskey wrote:
I am extracting addresses from an XML file to process through other
programs using pipe delimiter the following code works but this is going
to get 130,000 records through it it must be very efficient and I cannot
follow the
Ken Foskey wrote:
>
For the record on a more complex script than the address one...
xml:simple 7 hours plus on very quick machine, still running and
absolutely hammering the system, 1.3 Gig of memory used.
xml::twig 1 hour on laptop (underpowered and not much memory), Linux
still usable whil
Joel wrote:
>
Can you tell me the sequence of events that happen (internally in perl
during parsing) for the following code:
sub fun
{
print @_;
}
fun fun (1), fun 2, fun (3);
I am particularly interested in the comma operator, in the above code,
as I understand it
(1) first the list o
sanozuke wrote:
>
Iam new to Perl and wish to use it on visual studio C++ express
edition, but...
I don't know how.
Perl has a good tutorial very good inded, but what do i need to make
Perl run in windows and in Visual studio C++ express edition?
The recommended way of enabling Perl on a Window
jeevs wrote:
I am in need to write a script which will count the number of files
and directories in a given directory. It will also record the
statistics of the directory within the main directory.
I have thought of a hash structure like
%hash = {
filecnt => value,
dircnt
Richard Lee wrote:
Chas. Owens wrote:
On Sat, Mar 22, 2008 at 1:02 AM, Richard Lee <[EMAIL PROTECTED]> wrote:
let's say I have
@someting = qw/1 2 3 4/;
@something2 = qw/110 11 12/;
@something3 = qw/20 30 40 50/;
and I get the name of array from regular expression match something
like
Joel wrote:
Thank you Rob.
I am aware of that actually. To state my confusion, I wil get a better
example:
For the following code,
sub fun {
print "fun(@_) ";
}
fun 1, fun ''b" | "c", 1;
The output looks like:
fun(c,1) fun(1,1)
*but* the precedence of the operators used is as
[EMAIL PROTECTED] wrote:
> Hi,
> With regards to the script below, can somebody explain to me why
> testcounter after counting 1,2,3, remains at 3 all the time. I thought
> it would have been reset to zero by the outer while loop.
> Thanks
>
> #!c:\perl\bin\perl
> use strict;
> my $anything = 5;
>
Nasser wrote:
Hello,
I've written a little perl script based on the example at the
FFmpeg::Command cpan page. The code is as follows:
Always
use strict;
use warnings;
and declare all of your variables using 'my' close to their point of
use. That will stop a lot of simple errors from occurring
Richard Lee wrote:
>
Gunnar Hjalmarsson wrote:
C:\home>type test.pl
use Data::Dumper;
my %HoA = (
something => [ qw/val1 val2 val3 and so forth/ ],
something2 => [ qw/vala valb valc and so forth/ ],
something3 => [ qw/valZ valZ1 valZ2 so forth/ ],
);
my %HoH;
while ( ) {
/^(\S
Richard Lee wrote:
say I have @data which below was pushed(bunch of them) with below hash
of hash refernce
$VAR1 = {
'element' => {
'element2' => 'now',
'element3' => '2',
'element4' =>
Richard Lee wrote:
>
let's say I have
@someting = qw/1 2 3 4/;
@something2 = qw/110 11 12/;
@something3 = qw/20 30 40 50/;
and I get the name of array from regular expression match something like
this from some other file
$_ =~ /^(\S+) \s\s$/;
so, now $1 is either something or somethin
Bobby wrote:
Hi all,
I'm trying to write a simple do until loop to print out the value of
> $strA0 through $striA3. What i'm doing is replacing the value of 0
> through 3 in the $strA by joining two strings (my $strB = "strA".
> $count;). Right now my script is printing $strB as below. How do i
kens wrote:
# Or if you must use a counter
my $count = 0;
while ( defined($strA[$count]) )
{
print "$strA[$count++]\n";
}
for my $count (0 .. $#strA) {
print "[$count] = $strA[$count]\n";
}
**OR**
my $count = 0;
foreach (@strA) {
print "[$count] = $strA[$count]\n";
$count++;
}
Sharan Basappa wrote:
Hi,
Is there a way I can copy only part of an array into another array.
For example, I want to copy only first 8 elements of source array
into destination array.
my @dest = @source[0..7];
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail:
Sharan Basappa wrote:
On Tue, Mar 25, 2008 at 9:31 PM, Rob Dixon <[EMAIL PROTECTED]> wrote:
>>
Sharan Basappa wrote:
> Hi,
>
> Is there a way I can copy only part of an array into another array.
> For example, I want to copy only first 8 elements of source array
Keenlearner wrote:
I like to store multiline perl code inside a scalar variable, but I
don't want perl to interpolate the variable inside the code.
my $t = "abc";
my $s = <
If you put your terminating identifier in single-quotes, it behaves as
if the entire here-document is in single-quotes:
Jay Savage wrote:
If you want to see grep really shine, though, think about ways you
might use it to avoid calling print for every element in the return
list, e.g.
print join "\n", grep {$_ % 2 == 0} @list;
I think that's very misleading. Why should I want to avoid calling print
for each
R (Chandra) Chandrasekhar wrote:
Dear Folks,
I am trying to write a script to, among other things, non-interactively
download a file using a web link. Specifically, the file is a compressed
archive of firefox, and the link is:
http://www.mozilla.com/products/download.html?product=firefox-2.0
[EMAIL PROTECTED] wrote:
> Hi,
>
> I am doing some studies on sub modules and Lexical variables (my).
>
> With regards to diagram 1 below, what can I do so that the lexical $counter
> can count up to 4.
>
> Of course, one way of doing this is to change the lexical $counter into a
> global vari
Jay Savage wrote:
On Wed, Mar 26, 2008 at 9:47 PM, Rob Dixon <[EMAIL PROTECTED]> wrote:
Jay Savage wrote:
If you want to see grep really shine, though, think about ways you
might use it to avoid calling print for every element in the return
list, e.g.
print join "\n", g
sanket vaidya wrote:
Hi everyone,
Kindly go through the code below.
use strict;
use warnings;
sub hello;
my $ref = \&hello;
&{$ref};
sub hello
{
print "hello!!";
}
The output on perl 5.10 is
Hello!!
Whereas the output on perl 5.6.1 is
Hello!!1
Why two different outputs in two d
Jay Savage wrote:
[snip]
>>
In any case, if someone offered me a way of making my program run
in 20ms instead of 25ms I wouldn't be overly impressed, and
certainly don't see it as a case of grep 'shining'.
I think you missed my point. I may not have been clear. No, shaving a
few ms off runtime
ciwei wrote:
>
Given a multiple char patterns like ":C9" that repeated, how to write
a regex that repeat the patterns( which is non-atom ) 6 times. like
in below
WWPN:10:00:00:00:c9:2e:e8:90
I tried to define pattern to match
my $match= qr/ {:[0-9a-e][0-9a-e]}{6} /;
print matched if /$ma
[EMAIL PROTECTED] wrote:
>
On Mar 28, 6:54 pm, [EMAIL PROTECTED] (Lawrence Statton) wrote:
If you're using Gnu diff (i.e. the diff that comes with most Linuces)
--speed-large-files might help you, without having to jump through a
perl hoop.
--L
Problems:
1) it runs out of memory 8Gig of files
[EMAIL PROTECTED] wrote:
>
On Mar 28, 6:54 pm, [EMAIL PROTECTED] (Lawrence Statton) wrote:
>>
If you're using Gnu diff (i.e. the diff that comes with most Linuces)
--speed-large-files might help you, without having to jump through a
perl hoop.
Problems:
[snip]
>
3) The heiristic approach is
[EMAIL PROTECTED] wrote:
>
When I do string comparisons in perl the strings seem to ignore the
embedded hyphens.
>
I want to sort strings assuming the 'dictionary' order of the chars is
ASCII order: hypen, 0-9, A-Z.
>
It appears linux sort also has the problem (LC_ALL is blank).
>
Any ideas?
Trudge wrote:
>
Hi Trudge.
I'm trying to get a script to interpolate variable values in a
__DATA__ block if possible. This is a kind of alternative to a full-
blown template method. I'm not sure if I can even do what I want,
hence my posting here.
No, you can't do that. But see below.
The f
Gunnar Hjalmarsson wrote:
>
> Trudge wrote:
>>
>> I'm trying to get a script to interpolate variable values in a
>> __DATA__ block if possible. This is a kind of alternative to a full-
>> blown template method. I'm not sure if I can even do what I want,
>> hence my posting here.
>
> It can be done
Richard Lee wrote:
>
> While reading perl cookbook, I came to page 94 and having a hard time
> understanding this particular phrase
>
> my $sepchar = grep( /,/ => @_ ) ? ";" : ",";
>
> I recognize the ternary operator and grep but I am not sure how they are
> forming the meaning together.
>
>
Richard Lee wrote:
> Dr.Ruud wrote:
>> Richard Lee schreef:
>>
>>
>>> While reading perl cookbook, I came to page 94 and having a hard time
>>> understanding this particular phrase
>>>
>>> my $sepchar = grep( /,/ => @_ ) ? ";" : ",";
>>>
>> Shortcutting alternative:
>>
>> my $sepchar =
Dr.Ruud wrote:
> Rob Dixon schreef:
>> Richard Lee wrote:
>>> Dr.Ruud wrote:
>>>> Richard Lee schreef:
>
>>>>> While reading perl cookbook, I came to page 94 and having a hard
>>>>> time understanding this particular phrase
>>&
Chas. Owens wrote:
>
> In general, it doesn't matter if you want to work with a small piece
> of a language or the whole language, you still need to implement a
> parser for the whole language. You can get an eighty or ninety
> percent solution without a full parser, but there will always be
> pro
Johan wrote:
>
> The last line of this code
> foreach $PkgFile( @$PkgList )
> {
> if( $PkgFile =~m/^\s*$/)
>
> gives this warning message
> Use of uninitialized value in pattern match (m//) at packagefile.pm
> line 838.
>
> How can I solve this? (I have no idea what the code does...)
Som
Chas. Owens wrote:
> On Mon, Mar 31, 2008 at 2:30 PM, Rob Dixon <[EMAIL PROTECTED]> wrote:
> snip
>> > my $sepchar = ',';
>> > for (@_) { $sepchar = ";" and last if /\Q$sepchar/ }
>>
>> This relies on ';' being tru
John W. Krahn wrote:
> Rob Dixon wrote:
>> Dr.Ruud wrote:
>>> Rob Dixon schreef:
>>>> It's equivalent to:
>>>>
>>>> my $sepchar = ',';
>>>> foreach (@_) {
>>>> if (/,/) {
>>>>
Sharan Basappa wrote:
>
> I have installed permute module locally and added the path to my script.
> However, perl fails to find the module.
>
> The script:
> #!/usr/bin/perl
> use lib "/u/basappas/local/perl/Algorithm-Permute-0.06";
> use Algorithm::Permute;
> my @array = (1..9);
> Algorithm::Per
[EMAIL PROTECTED] wrote:
>
> How do I extract the last digit of a number? example I only want the
digit 9 from the number 19.
>
> my $number = 19;
There are a few ways.
my $lastdigit = substr $number, -1;
gives you the last character in the string
my $lastdigit = $number % 10;
gives you t
John W. Krahn wrote:
> [EMAIL PROTECTED] wrote:
>> Hi,
>
> Hello,
>
>> How do I extract the last digit of a number? example I only want the digit 9
>> from the number 19.
>>
>> my $number = 19;
>
> my $last_digit = chop $number;
Yes, although it's important to note that that method removes the
yitzle wrote:
> Is there some way to convert it (a string/scalar) to an array?
Is this what you mean?
my $string = 'ABCDEF';
my @string = split '', $string;
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
Richard Lee wrote:
> What is the best way to indicate past hour from current time without
> using a module?
>
> so if it's 12:00, then 11:00-12:00
>
> if it's 17:30 then 16:30 to 17:30
>
> if it's 00:30 then 23:30 to 00:30
>
> I wrote a below program and works but there has to be a better and
[EMAIL PROTECTED] wrote:
>
> Thanks everyone for the help!
> I get an error on 'chop' when I use the following. Why is this so?
> Thanks
>
> use strict;
> use warnings;
> my @eightdecks = 1..20;
> my $last = chop ($eightdecks[0] + $eightdecks[2]);
>
> if ($last =~ /[0-5]/){
> print "yes match
Jennifer G. wrote:
> How do I know this day is in NO. which week in this year?
> for example, Jan 1 is in the no.1 week of this year.
> but how about the current day?
It's a little more complicated than that. Week one is the first week in
the year that has four or more days, so if Jan 1 falls on a
inthepickle wrote:
>
> Really quick question. In Perl, if I open a file in notepad
> system( "notepad.exe $file" ) ;
> Perl stops processes and will not continue until I close notpad.
> How can I open the file, and have Perl continue running?
Quick question, slow answer.
Perl will either spawn a
Jenda Krynicky wrote:
>
> From: inthepickle <[EMAIL PROTECTED]>
>
>> Really quick question. In Perl, if I open a file in notepad
>> system( "notepad.exe $file" ) ;
>> Perl stops processes and will not continue until I close notpad.
>> How can I open the file, and have Perl continue running?
>
> s
e-letter wrote:
>
> I have a csv file (greater than 256 columns hence unable to open in
> spreadsheet) of the following format:
>
> column header1, column header2, column header3
> 1,0.0e0,0.0e0,5e-6
> 2,0.0e0,0.0e0,6e-7
> 3,0.0e0,0.0e0,0.0e0
>
> I want to perform: "if column headerx contains on
Gerald Wheeler wrote:
> Need some assistance:
> A script that writes (will usually appends) 8 records
> (rows/lines/whatever) to a flat file
> problem:
> If there are NO records with the date (date format: 03-Apr-08)
> of the "incoming data" I want to write/append these records to the file
>
e-letter wrote:
> Readers,
>
> I have a csv file (greater than 256 columns hence unable to open in
> spreadsheet) of the following format:
>
> column header1, column header2, column header3
> 1,0.0e0,0.0e0,5e-6
> 2,0.0e0,0.0e0,6e-7
> 3,0.0e0,0.0e0,0.0e0
>
> I want to perform: "if column headerx
[EMAIL PROTECTED] wrote:
> Hi,
> With regards to the script below, inside the foreach loop, can
> someone explain to me why the expression $_=~ s/\nfred\n/nancy/;
> did not change the default variable $_ from fred (enclosed by \n) to nancy.
>
> Thanks
>
> # start of script ###
Chas. Owens wrote:
> On Thu, Apr 3, 2008 at 7:29 PM, Ryan <[EMAIL PROTECTED]> wrote:
>> I know they are both the same, I just want to know why we have both.
> snip
>
> Because originally they meant different things. The for loop was a
> c-style loop and the foreach loop was an iterator. Eventual
Gerald Wheeler wrote:
>
>>>> Rob Dixon <[EMAIL PROTECTED]> 4/3/2008 3:49 PM >>>
> Gerald Wheeler wrote:
>> Need some assistance:
>> A script that writes (will usually appends) 8 records
>> (rows/lines/whatever) to a flat file
>> problem:
&
Chas. Owens wrote:
> On Thu, Apr 3, 2008 at 8:19 PM, Rob Dixon <[EMAIL PROTECTED]> wrote:
>> Chas. Owens wrote:
>> > On Thu, Apr 3, 2008 at 7:29 PM, Ryan <[EMAIL PROTECTED]> wrote:
>> >> I know they are both the same, I just want to know why we
1 - 100 of 3288 matches
Mail list logo