Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

The Monastery Gates

( #131=superdoc: print w/replies, xml ) Need Help??

If you're new here please read PerlMonks FAQ
and Create a new user.

Quests
poll ideas quest 2021
Starts at: Jan 01, 2021 at 00:00
Ends at: Dec 31, 2021 at 23:59
Current Status: Active
5 replies by pollsters
    First, read How do I create a Poll?. Then suggest your poll here. Complete ideas are more likely to be used.

    Note that links may be used in choices but not in the title.

Perl News
OT. Malicious software in PyPI
on Jul 30, 2021 at 08:18
1 reply by parv
Perl/Raku community involvement survey
on Jul 16, 2021 at 13:53
2 replies by jdporter

    Episodic Volunteering in Free/Libre/Open Source (FLOSS) Communities - a survey by kudra

    TPF announcement

    ... research to understand episodic, or occasional, participation in the Perl and Raku communities... The results of the research will be provided as a TPF report and will assist the community in improving practices for managing episodic participation to provide insights into what FLOSS projects could do to become more sustainable.
Supplications
Inspect the members of a Posix Character Class
5 direct replies — Read more / Contribute
by NERDVANA
on Jul 29, 2021 at 08:47

    Perl knows about a lot of posix character classes because you can match against them with the regex library. But what if you want to reverse that? I would like to iterate the characters that belong to a named character class, and take advantage of Perl's knowledge rather than building massive lists of my own. I would also like to avoid brute-force solutions like iterating every character and testing each for membership in the set.

    Does anyone know if there is a good way to do this? Ideally quick enough to look up random members of the set in log(n) time or better.

    Example of a Not-Good way to do this:

    my @alpha= grep /[[:alpha:]]/, map chr, 0..0xEFFFF; return $alpha[rand scalar @alpha];
list of lists?
6 direct replies — Read more / Contribute
by guthrie
on Jul 29, 2021 at 00:04
    beginner confusion... I had a list of values that i iterated over:
    my @zips=("52544", "52557", "50428", "50219"); foreach $zip (@zips) { ... }
    Now I want more information for each item, so I have this:
    my @sites=( ("50049", "city1", "url1"), ("52556", "city2", "url2"), ("50219", "city3", "url3") ) foreach (my $zip, my $name, $my $url) { ... }
    which fails. I have tried multiple permutations, but cannot seem to get the iteration over tuples from an array of tuples right. TIA.
pack on unpack with same template
3 direct replies — Read more / Contribute
by jjmoka
on Jul 27, 2021 at 18:33
    I've found this code
    $$xmlScalar_r = pack('U0C*', unpack('U0C*', SGMLencode_data($$xmlScalar_r)||(defined($$xmlScalar_r) ? $$xmlScalar_r : '') ));
    
    regardless of everything in the end, it is then just something like:
    $string = ... $x = pack('U0C*', unpack('U0C*', $string));
    I see nothing different which cannot be done as just
    $x = $string #or without even $string, just $x = ...
    so it would seem a useless usage of pack and unpack being the template the same.

    Are there special cases of any sort (e.g. different environments, architectures)
    where the pack/unpack achieve anything different ?
    Thanks
Dealing with nextline of a file
6 direct replies — Read more / Contribute
by jnarayan81
on Jul 27, 2021 at 04:37

    When I tried to read nextline, the pointer in the while loop reads two lines at a time. Is there another creative way to deal with the file's next line?

    use strict; use warnings; my %store; my $nextline; my $cnt=1; my $filename = "$ARGV[0]"; open(my $fh, '<:encoding(UTF-8)', $filename) or die "Could not open fi +le '$filename' $!"; while (my $row = <$fh>) { chomp $row; my @tmp = split /\s+/, $row; $nextline = <$fh>; chomp $nextline; my @nexttmp = split /\s+/, $nextline; print "$row\t$cnt\n"; if ($tmp[0] ne $nexttmp[0]) { $cnt++; } print "$nextline\t$cnt\n"; } close $filename;
Generate a thumbnail for a given link
2 direct replies — Read more / Contribute
by Matthew.S
on Jul 25, 2021 at 10:31
    Hello Perl Monks. I'm looking to write a Perl utility that will accept a link to some web page/resource and will generate a thumbnail for that web page (assuming that the given web page/resource supports it). When saying "thumbnail" I expect to generate something like say WhatsApp generates when You paste a link into it (a picture with some short text title and a link). The desired output from the utility could be an image file and a textual title in a text file that I can later use to my needs. What general approach would You suggest for me to take? Thank You for Your wisdom.
file modifications using file::find
4 direct replies — Read more / Contribute
by propellerhat
on Jul 24, 2021 at 21:59
    After much searching and reading, the articles I have have found regarding File::Find do nothing other than list file names, though they begin by saying things such as "do something with file". I need help or a tutorial which shows me how to: (1) run an IF check on files located by File::Find (2) read from and write to a file which passes the IF check I suppose File::Find returns whatever I need to open a filehandle, but I have not located the File::Find specification.
Cool Uses for Perl
Inline::CUDA : looking for feedback
2 direct replies — Read more / Contribute
by bliako
on Jul 28, 2021 at 05:52

    Hi all,

    I have placed a preliminary version of Inline::CUDA at https://github.com/hadjiprocopis/perl-inline-cuda, it has only been installed on my machine (Linux, GeForce 650). I would be grateful for comments from anybody who would try to install it in their machines: OSX, Windows, other Linux versions with different NVIDIA GPU versions.

    It's a lot of work to download the huge NVIDIA CUDA SDK and it is very likely that you will also need to install a specific compiler version (additional to your system compiler). So, be prepared to spend a few hours on it! I apologise!

    Hopefully, with your insight and feedback I will be able to create a better installation workflow. I have Alien::Build in mind.

    Comments and feedback on the actual code and style are very welcome as well.

    Many Thanks

    bw, bliako

    Edit: I have got a bit more into git and I think I have managed to master a git-commit-push workflow. I hope from now on it will not copy all files back to the repository but only those with changes.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (1)
As of 2021-07-31 08:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?