User Profile
Collapse
-
pwilliams replied to Without using $_[0] etc. a subroutine can only be invoked once in a programme .in PerlRonB how very very wrong can one be! When I last did homework, we were in the UK, still using £.s.d and I would hazard a guess that you were not even born! -
pwilliams started a topic Without using $_[0] etc. a subroutine can only be invoked once in a programme .in PerlWithout using $_[0] etc. a subroutine can only be invoked once in a programme .
Unless I use all subscripts in a subroutine it just gives the same answer to a subsequent call,I've been through the Llama with a fine-toothcomb and yes,I've tried the net.
All I'm trying to do is write a programme for factorials,
ie N!/(N - R)!.
Thanks in anticipation. -
Thanks chorny,diagnost ics didn't give much help;I think I'll leave the matter until a later date.Leave a comment:
-
pwilliams started a topic Why `require`,a subroutine refuses to work unless I use a very obscure format?in PerlWhy `require`,a subroutine refuses to work unless I use a very obscure format?
Code:sub fa { # $_[0] = 1; $_[1] = 1; $_[2] = 0; for($_[2] = 1 ; $_[2] <= $_[0];$_[2]++) { $_[1] *= $_[2]; } return $_[1]; } 1; #This code works perfectly;its aim is to find the #factorial of a number. # It is invoked from another file shown below....Code:#!/usr/bin/perl use warnings; use strict; require 'comph.pl';
-
Message deletedLeave a comment:
-
Many thanks Nepomuk for your lucid and comprehensive guidance.
All the best,
pwilliams.Leave a comment:
-
Install and run a distro FROM a usb stick.
How does one install an OS on a usb stick and run it from there?
Many distros refer to a usb version but only as a means to install on an HD.
I have 4Gb stick and am looking at Minix. -
Output of ls command in octal
...Code:function lso { ls -l | awk '{ k = 0 s = 0 for( i = 0; i <= 8; i++ ) { k += ( ( substr( $1, i+2, 1 ) ~ /[rwxst]/ ) * 2 ^( 8 - i ) ) } j = 4 for( i = 4; i <= 10; i += 3 ) { s += ( ( substr( $1, i, 1 ) ~ /[stST]/ ) * j ) j/=2Leave a comment:
-
Output of ls command in octal
Oralloy ,ashitpro many thanks for your replies.
With a red face I must confess,the file came to light in a totally wrong directory , on a usb stick I had forgotten about.Would anybody be interested in seeing it?Leave a comment:
-
Output of ls command in octal
Some time ago I copied a bash shell script from a site which I cannot trace. It was written in bash and awk and was not good but superb ! It was about 25 lines long. I had made it into a function and was using it regularly but in a change of distro I lost it . Can anyone help? -
Controlling the cusor in the file browser in Vim
Yes sicarie,and so far ` :Rex ` seems to be the only option.Leave a comment:
-
Controlling the cusor in the file browser in Vim
Many thanks for your reply sicarie . No I'm afraid Ctrl+O does not work,as I say, it sends the cursor right to the bottom of the list ;Ctrl^ is slightly better taking the cursor to the very top of the list ; best of all so far is not a Ctrl Command but ` :Rexplore ` or ` :Rex `, this takes the cursor right back onto the name of the file that has just been exited . What I was trying...Leave a comment:
-
Thanks for the tip Nepomuk,I've had a look at`places.sqlit e`;yes,I agree they are best left well alone,for the time being at least.Leave a comment:
-
Controlling the cusor in the file browser in Vim
From the command line I enter `vim`.
I am greeted with the Vim version number etc.
Then I type ` :e .`
I'm now in the file browser.
I get the usual long list of files,I move the cursor say to
the fourth from the top , enter the file and edit it ,so far so good.
NOW I use` ^O ` ie.` Ctrl O`. Here is the irritation -- The cursor
goes right to the bottom of the list. Is there a way of curing
... -
I had a good look-very interesting,but it all led back to GUI,the nearest to text was `json`.I think I'll leave it for now;Many thanks for kind help sicarie.Leave a comment:
-
No success,under mozilla or firefox.
I even tried typing firefox in terminal- just opened firefox window - "url not found" - it all led back to GUI.
Tried /usr....... files No joy!Leave a comment:
-
Thanks sicarie for your response.
As you know clicking on bookmarks or history in GUI gets
long lists of files,but what I'm looking for is the relevant files in text form, that I can delete or move into directories that I would create.I suspect that some of these files may not be in plain text (I think,for example that emails are in Jason?).
I do have GUI but find text and the command line farLeave a comment:
-
pwilliams started a topic Editing Firefox 3.6.8 bookmarks & history with Bash 4.1.5 on Ubuntu 10.04 ?in LinuxEditing Firefox 3.6.8 bookmarks & history with Bash 4.1.5 on Ubuntu 10.04 ?
Is it possible to edit Firefox bookmarks and or history using the command line or a Bash shell script.
Any examples would be more than appreciated - using the mouse is a pain for deletion;I've searched for relevant files with `locate`and Vim but I'm apprehensive about messing up and losing data. -
How can a single line of user input be converted into multiple variables ?
Many thanks for such a rapid solution ; the online articles
make no reference ,to the best of my knowledge, to multiple variables for input / raw_input.Leave a comment:
-
pwilliams started a topic How can a single line of user input be converted into multiple variables ?in PythonHow can a single line of user input be converted into multiple variables ?
For example:
info= input('Enter name address and telephone number\n')
I have tried declaring variables in advance ie.
var1 = " " var2 = " " var3 = " " but to no avail. Can you please help ?
Thanks in anticipation.
No activity results to display
Show More
Leave a comment: